https://github.com/rmawatson/flutter_startup
Provides iOS startup reasons to flutter
https://github.com/rmawatson/flutter_startup
dart flutter flutter-plugin flutter-plugins
Last synced: 8 months ago
JSON representation
Provides iOS startup reasons to flutter
- Host: GitHub
- URL: https://github.com/rmawatson/flutter_startup
- Owner: rmawatson
- License: mit
- Created: 2019-02-14T15:05:26.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T04:06:34.000Z (almost 7 years ago)
- Last Synced: 2025-04-25T15:26:34.402Z (8 months ago)
- Topics: dart, flutter, flutter-plugin, flutter-plugins
- Language: Dart
- Homepage:
- Size: 67.4 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_startup
Provides access to the iOS startup reasons. The intented application is to control the behavior of the main isolate based on why the app was started. For example, when using `bluetooth-central` background mode, with an active background scan, if the app is killed and there is an event to be handled for the bluetooth `centralManger`, iOS will relauch the app for a limited period of time to handle the event.
Using the flutter_startup the main isolate can branch on the startup reason to perform some other task before the application is killed (about 10 seconds for the `UIApplicationLaunchOptionsBluetoothCentralsKey` in this case), or it gracefully exit itself.
# Usage
```
void main() async {
print("${await FlutterStartup.startupReason}");
}
```
where `startupReason` is one of;
```
FlutterStartup.StartupReasonUser = "User"
FlutterStartup.iOSStartupReasonAnnotation = "UIApplicationLaunchOptionsAnnotationKey"
FlutterStartup.iOSStartupReasonBluetoothCentrals = "UIApplicationLaunchOptionsBluetoothCentralsKey"
FlutterStartup.iOSStartupReasonBluetoothPeripherals = "UIApplicationLaunchOptionsBluetoothPeripheralsKey"
FlutterStartup.iOSStartupReasonCloudKitShareMetadata = "UIApplicationLaunchOptionsCloudKitShareMetadataKey"
FlutterStartup.iOSStartupReasonLocalNotification = "UIApplicationLaunchOptionsLocalNotificationKey"
FlutterStartup.iOSStartupReasonLocation = "UIApplicationLaunchOptionsLocationKey"
FlutterStartup.iOSStartupReasonNewsstandDownloads = "UIApplicationLaunchOptionsNewsstandDownloadsKey"
FlutterStartup.iOSStartupReasonRemoteNotification = "UIApplicationLaunchOptionsRemoteNotificationKey"
FlutterStartup.iOSStartupReasonShortcutItem = "UIApplicationLaunchOptionsShortcutItemKey"
FlutterStartup.iOSStartupReasonSourceApplication = "UIApplicationLaunchOptionsSourceApplicationKey"
FlutterStartup.iOSStartupReasonURL = "UIApplicationLaunchOptionsURLKey"
FlutterStartup.iOSStartupReasonUserActivityDictionary = "UIApplicationLaunchOptionsUserActivityDictionaryKey"
FlutterStartup.iOSStartupReasonUserActivityType = "UIApplicationLaunchOptionsUserActivityTypeKey"
FlutterStartup.iOSStartupReasonUser = StartupReasonUser
FlutterStartup.AndroidStartupReasonUser = StartupReasonUser
```