1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-11 23:39:14 +00:00

veggieseasons: Migrate to null safety (#922)

This commit is contained in:
Brett Morgan
2021-10-12 10:27:54 +11:00
committed by GitHub
parent 994cdb4afa
commit ac2bef7d83
21 changed files with 134 additions and 148 deletions

View File

@@ -16,7 +16,7 @@ class Preferences extends ChangeNotifier {
static const _preferredCategoriesKey = 'preferredCategories';
// Indicates whether a call to [_loadFromSharedPrefs] is in progress;
Future<void> _loading;
Future<void>? _loading;
int _desiredCalories = 2000;
@@ -79,9 +79,7 @@ class Preferences extends ChangeNotifier {
if (names != null && names.isNotEmpty) {
for (final name in names.split(',')) {
final index = int.tryParse(name) ?? -1;
if (VeggieCategory.values[index] != null) {
_preferredCategories.add(VeggieCategory.values[index]);
}
_preferredCategories.add(VeggieCategory.values[index]);
}
}