intermediate

This commit is contained in:
Fabian Freund
2024-09-13 09:11:06 +02:00
parent 3b047b5d8a
commit 37d2c84d7f
155 changed files with 5666 additions and 1816 deletions
@@ -1,4 +1,3 @@
import 'package:flutter_mozilla_components/src/helper/helper.dart';
import 'package:flutter_mozilla_components/src/pigeons/gecko.g.dart';
/// Describes a category of an external package.
@@ -16,6 +15,13 @@ enum PackageCategory {
final int id;
const PackageCategory(this.id);
factory PackageCategory.fromInt(int? id) {
return PackageCategory.values.firstWhere(
(category) => category.id == id,
orElse: () => PackageCategory.unknown,
);
}
PackageCategoryValue toValue() {
return PackageCategoryValue(value: id);
}
@@ -36,7 +42,7 @@ abstract class Source {
final caller = packageId != null
? ExternalPackage(
packageId: packageId,
category: packageCategoryfromInt(packageCategory).toValue())
category: PackageCategory.fromInt(packageCategory).toValue())
: null;
switch (sourceId) {