Skip to content

Commit 7f08323

Browse files
Refactor pattern matching for FolderItem cases
1 parent b46eaf8 commit 7f08323

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎lib/providers/launcher_model.dart‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ class LauncherModel extends ChangeNotifier with WidgetsBindingObserver {
349349
final j = jsonDecode(rawHome);
350350
if (j is List) {
351351
for (final page in j) {
352-
if (page is List)
352+
if (page is List) {
353353
_home.add(_normalizePage(page.map(LItem.fromJson)));
354+
}
354355
}
355356
}
356357
} catch (_) {}
@@ -493,7 +494,7 @@ class LauncherModel extends ChangeNotifier with WidgetsBindingObserver {
493494
} else if (_drawerFree) {
494495
cleaned.add(null);
495496
}
496-
case FolderItem f:
497+
case final FolderItem f:
497498
final pk = f.pkgs.where((p) => _isVisible(p) && seen.add(p)).toList();
498499
if (pk.length >= 2) {
499500
cleaned.add(f.copyWith(pkgs: pk));
@@ -536,7 +537,7 @@ class LauncherModel extends ChangeNotifier with WidgetsBindingObserver {
536537
return null;
537538
case AppItem(:final pkg):
538539
return _isVisible(pkg) ? it : null;
539-
case FolderItem f:
540+
case final FolderItem f:
540541
final pk = f.pkgs.where(_isVisible).toList();
541542
if (pk.length >= 2) return f.copyWith(pkgs: pk);
542543
if (pk.length == 1) return AppItem(pk.first);

0 commit comments

Comments
 (0)