diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-04 00:05:13 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-04 00:05:13 +0530 |
| commit | e8c7759250cf7a7eb1fc0047a4cef27cd75ab15b (patch) | |
| tree | 36c3d4c6de31bf00aacbc63768a102a342d0347e /lib/data/favorites.dart | |
| parent | cee800d5105b359d38681251fd2c997e1f84220d (diff) | |
| download | daft-launcher-e8c7759250cf7a7eb1fc0047a4cef27cd75ab15b.tar.gz daft-launcher-e8c7759250cf7a7eb1fc0047a4cef27cd75ab15b.zip | |
fixes empty list issues
Diffstat (limited to 'lib/data/favorites.dart')
| -rw-r--r-- | lib/data/favorites.dart | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/data/favorites.dart b/lib/data/favorites.dart index 2e389b8..45f1e00 100644 --- a/lib/data/favorites.dart +++ b/lib/data/favorites.dart @@ -8,7 +8,7 @@ const String SEPERATOR = ','; StreamController<List<Application>> favorites_$ = StreamController<List<Application>>.broadcast(); Future<Application> getApplication(String pkg) async { - if (pkg.length == 0) return null; + if (pkg == null || pkg.length == 0) return null; try { return DeviceApps.getApp(pkg); } catch(e) { @@ -49,7 +49,7 @@ void setFavorites(List<Application> favs) async { } void addToFavorites(Application app) async { - List<Application> fs = await getFavorites(); + List<Application> fs = await getFavorites() as List<Application>; var matching = fs.where((a) => a.packageName == app.packageName); if(matching.length == 0) { |
