diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-05 21:55:06 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-05 21:55:06 +0530 |
| commit | f4fc9576aa77045d3b6c26263a7200af0c8b6151 (patch) | |
| tree | 5d139bb258ae60fb3d1371652ad6c884ead3abc9 /lib/data/applications.dart | |
| parent | 83be047e15efd91a26ac27da1710b0e273706b19 (diff) | |
| download | daft-launcher-f4fc9576aa77045d3b6c26263a7200af0c8b6151.tar.gz daft-launcher-f4fc9576aa77045d3b6c26263a7200af0c8b6151.zip | |
refactors application data to use streams
Diffstat (limited to '')
| -rw-r--r-- | lib/data/applications.dart | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/data/applications.dart b/lib/data/applications.dart new file mode 100644 index 0000000..c0f8f32 --- /dev/null +++ b/lib/data/applications.dart @@ -0,0 +1,22 @@ +import 'package:device_apps/device_apps.dart'; +import 'dart:async'; + +StreamController<List<Application>> applications_$ = StreamController<List<Application>>.broadcast(); + +Future<List<Application>> getApplications() { + return DeviceApps.getInstalledApplications( + includeSystemApps: true, + onlyAppsWithLaunchIntent: true, + includeAppIcons: false, + ); +} + +void refreshApplications() async { + List<Application> apps = await getApplications(); + applications_$.add(apps); +} + +Stream<List<Application>> getApplications$() { + return applications_$.stream; +} + |
