Skip to content

Commit f712987

Browse files
authored
Merge pull request #1 from okmsbun/develop
Develop
2 parents 7698b4f + a169018 commit f712987

5 files changed

Lines changed: 10 additions & 126 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.4.0
2+
App change events now forward the raw Android action string to Dart, which maps it to AppChangeType without breaking existing API.
3+
14
## 0.2.0
25
- Enhanced README.md with professional badge layout for better package visibility
36
- Added centered HTML badges for pub.dev, GitHub stars, Flutter documentation, and MIT license

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 okmsbun
3+
Copyright (c) 2026 okmsbun
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -16,107 +16,6 @@ This package defines the common API contract (Dart side) that all platform imple
1616

1717
---
1818

19-
## ✨ What it provides
19+
## License
2020

21-
* `AppInfo` model → metadata for installed apps (package name, version, install/update times, system flag, optional icon bytes).
22-
* `AppChangeEvent` model → events for install, uninstall, update.
23-
* `FlutterDeviceAppsPlatform` abstract class → base interface every platform package must extend.
24-
- `listApps()` - List installed applications
25-
- `getApp()` - Get details for a specific app
26-
- `openApp()` - Launch an application
27-
- `openAppSettings()` - Open app settings page
28-
- `uninstallApp()` - Uninstall an application
29-
- `getInstallerStore()` - Get installer store information
30-
- `appChanges` - Stream of app change events
31-
- `startAppChangeStream()` / `stopAppChangeStream()` - Control event monitoring
32-
33-
---
34-
35-
## 🚫 When NOT to use this package
36-
37-
You should **not** depend on this package directly in your Flutter apps.
38-
39-
Instead, use the umbrella package:
40-
41-
```yaml
42-
dependencies:
43-
flutter_device_apps: latest_version
44-
```
45-
46-
This interface is only intended for platform implementors (e.g. `flutter_device_apps_android`).
47-
48-
---
49-
50-
## 🛠 For platform implementors
51-
52-
To add support for a new platform:
53-
54-
1. Create a new package (e.g. `flutter_device_apps_linux`).
55-
56-
2. Add a dependency on this package:
57-
58-
```yaml
59-
dependencies:
60-
flutter_device_apps_platform_interface: latest_version
61-
```
62-
63-
3. Extend `FlutterDeviceAppsPlatform` and override the required methods:
64-
65-
```dart
66-
class FlutterDeviceAppsLinux extends FlutterDeviceAppsPlatform {
67-
@override
68-
Future<List<AppInfo>> listApps({bool includeSystem = false, bool onlyLaunchable = true, bool includeIcons = false}) {
69-
// implement using Linux APIs
70-
}
71-
72-
@override
73-
Future<AppInfo?> getApp(String packageName, {bool includeIcon = false}) {
74-
// implement
75-
}
76-
77-
@override
78-
Future<bool> openApp(String packageName) {
79-
// implement
80-
}
81-
82-
@override
83-
Future<bool> openAppSettings(String packageName) {
84-
// implement - open app settings page
85-
}
86-
87-
@override
88-
Future<bool> uninstallApp(String packageName) {
89-
// implement - uninstall app
90-
}
91-
92-
@override
93-
Future<String?> getInstallerStore(String packageName) {
94-
// implement - get installer store information
95-
}
96-
97-
@override
98-
Stream<AppChangeEvent> get appChanges => _streamController.stream;
99-
100-
@override
101-
Future<void> startAppChangeStream() async {
102-
// setup listener
103-
}
104-
105-
@override
106-
Future<void> stopAppChangeStream() async {
107-
// tear down listener
108-
}
109-
}
110-
```
111-
112-
4. Register your implementation by setting:
113-
114-
```dart
115-
FlutterDeviceAppsPlatform.instance = FlutterDeviceAppsLinux();
116-
```
117-
118-
---
119-
120-
## 📄 License
121-
122-
MIT © 2025 okmsbun
21+
MIT © 2026 okmsbun

lib/flutter_device_apps_platform_interface.dart

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,10 @@ abstract class FlutterDeviceAppsPlatform extends PlatformInterface {
128128
///
129129
/// Platform implementations should emit [AppChangeEvent] objects when apps
130130
/// are installed, removed, or updated on the device.
131-
/// Call [startAppChangeStream] to begin receiving events.
132-
Stream<AppChangeEvent> get appChanges;
133-
134-
/// Starts monitoring for app change events.
135-
///
136-
/// Call this method to begin receiving app change events via [appChanges] stream.
137-
/// Platform implementations should set up necessary listeners or broadcast receivers.
138-
Future<void> startAppChangeStream();
139-
140-
/// Stops monitoring for app change events.
141131
///
142-
/// Call this method to stop receiving app change events and clean up resources.
143-
/// Platform implementations should remove listeners or unregister broadcast receivers.
144-
Future<void> stopAppChangeStream();
132+
/// The stream automatically starts listening when the first subscriber is added
133+
/// and stops when all subscribers are removed (broadcast stream behavior).
134+
Stream<AppChangeEvent> get appChanges;
145135

146136
/// Opens the app settings for the specified package name.
147137
///
@@ -186,14 +176,6 @@ class _UnimplementedPlatform extends FlutterDeviceAppsPlatform {
186176
Stream<AppChangeEvent> get appChanges =>
187177
Stream.error(UnsupportedError('FlutterDeviceAppsPlatform not implemented'));
188178

189-
@override
190-
Future<void> startAppChangeStream() =>
191-
Future.error(UnsupportedError('FlutterDeviceAppsPlatform not implemented'));
192-
193-
@override
194-
Future<void> stopAppChangeStream() =>
195-
Future.error(UnsupportedError('FlutterDeviceAppsPlatform not implemented'));
196-
197179
@override
198180
Future<bool> openAppSettings(String packageName) =>
199181
Future.error(UnsupportedError('FlutterDeviceAppsPlatform not implemented'));

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_device_apps_platform_interface
22
description: Platform-agnostic API contract for flutter_device_apps (federated).
3-
version: 0.2.0
3+
version: 0.4.0
44
repository: https://github.com/okmsbun/flutter_device_apps_platform_interface
55
issue_tracker: https://github.com/okmsbun/flutter_device_apps_platform_interface/issues
66
topics:

0 commit comments

Comments
 (0)