aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-06-04 00:05:13 +0530
committerAkshay Nair <phenax5@gmail.com>2020-06-04 00:05:13 +0530
commite8c7759250cf7a7eb1fc0047a4cef27cd75ab15b (patch)
tree36c3d4c6de31bf00aacbc63768a102a342d0347e
parentcee800d5105b359d38681251fd2c997e1f84220d (diff)
downloaddaft-launcher-e8c7759250cf7a7eb1fc0047a4cef27cd75ab15b.tar.gz
daft-launcher-e8c7759250cf7a7eb1fc0047a4cef27cd75ab15b.zip
fixes empty list issues
Diffstat (limited to '')
-rw-r--r--.flutter-plugins-dependencies2
-rw-r--r--TODO.md2
-rw-r--r--lib/data/favorites.dart4
-rw-r--r--lib/main.dart5
4 files changed, 5 insertions, 8 deletions
diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies
index ff3074a..71490bc 100644
--- a/.flutter-plugins-dependencies
+++ b/.flutter-plugins-dependencies
@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/","dependencies":[]}],"android":[{"name":"android_intent","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.7+2/","dependencies":[]},{"name":"device_apps","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/device_apps-1.0.9/","dependencies":[]},{"name":"shared_preferences","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"android_intent","dependencies":[]},{"name":"device_apps","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}],"date_created":"2020-06-03 23:34:53.607416","version":"1.19.0-2.0.pre.214"} \ No newline at end of file
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/","dependencies":[]}],"android":[{"name":"android_intent","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.7+2/","dependencies":[]},{"name":"device_apps","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/device_apps-1.0.9/","dependencies":[]},{"name":"shared_preferences","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/akshayn/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"android_intent","dependencies":[]},{"name":"device_apps","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}],"date_created":"2020-06-03 23:39:26.967680","version":"1.19.0-2.0.pre.214"} \ No newline at end of file
diff --git a/TODO.md b/TODO.md
index 12482a1..d7209dd 100644
--- a/TODO.md
+++ b/TODO.md
@@ -16,6 +16,8 @@
- [X] Get rid of defaultTime and loading
- [X] Create favorites list
- [X] Get favorites list from a persistent store
+ - [ ] Remove from favorites
+ - [ ] Change the order of favorites?
## Applications list
- [X] Create app list
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) {
diff --git a/lib/main.dart b/lib/main.dart
index b11886a..a223fb7 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -34,11 +34,6 @@ class MyAppState extends StreamState<MyApp> {
initConfig();
initStateValue(favoriteApps);
initFavorites();
-
- SharedPreferences.getInstance().then((instance) {
- var val = instance.getString('favorites');
- debugPrint('Hello |${val}| ${val.length}');
- });
}
@override