flutter_device_apps_platform_interface 0.2.0
flutter_device_apps_platform_interface: ^0.2.0 copied to clipboard
Platform-agnostic API contract for flutter_device_apps (federated).
flutter_device_apps_platform_interface #
Platform interface for the flutter_device_apps federated plugin.
This package defines the common API contract (Dart side) that all platform implementations of flutter_device_apps
must follow.
✨ What it provides #
AppInfo
model → metadata for installed apps (package name, version, install/update times, system flag, optional icon bytes).AppChangeEvent
model → events for install, uninstall, update.FlutterDeviceAppsPlatform
abstract class → base interface every platform package must extend.listApps()
- List installed applicationsgetApp()
- Get details for a specific appopenApp()
- Launch an applicationopenAppSettings()
- Open app settings pageuninstallApp()
- Uninstall an applicationgetInstallerStore()
- Get installer store informationappChanges
- Stream of app change eventsstartAppChangeStream()
/stopAppChangeStream()
- Control event monitoring
🚫 When NOT to use this package #
You should not depend on this package directly in your Flutter apps.
Instead, use the umbrella package:
dependencies:
flutter_device_apps: latest_version
This interface is only intended for platform implementors (e.g. flutter_device_apps_android
).
🛠 For platform implementors #
To add support for a new platform:
-
Create a new package (e.g.
flutter_device_apps_linux
). -
Add a dependency on this package:
dependencies: flutter_device_apps_platform_interface: latest_version
-
Extend
FlutterDeviceAppsPlatform
and override the required methods:class FlutterDeviceAppsLinux extends FlutterDeviceAppsPlatform { @override Future<List<AppInfo>> listApps({bool includeSystem = false, bool onlyLaunchable = true, bool includeIcons = false}) { // implement using Linux APIs } @override Future<AppInfo?> getApp(String packageName, {bool includeIcon = false}) { // implement } @override Future<bool> openApp(String packageName) { // implement } @override Future<bool> openAppSettings(String packageName) { // implement - open app settings page } @override Future<bool> uninstallApp(String packageName) { // implement - uninstall app } @override Future<String?> getInstallerStore(String packageName) { // implement - get installer store information } @override Stream<AppChangeEvent> get appChanges => _streamController.stream; @override Future<void> startAppChangeStream() async { // setup listener } @override Future<void> stopAppChangeStream() async { // tear down listener } }
-
Register your implementation by setting:
FlutterDeviceAppsPlatform.instance = FlutterDeviceAppsLinux();
📄 License #
MIT © 2025 okmsbun