flutter_startup 0.0.2 copy "flutter_startup: ^0.0.2" to clipboard
flutter_startup: ^0.0.2 copied to clipboard

Startup reason plugin for Flutter

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
4
likes
30
pub points
36%
popularity

Publisher

unverified uploader

Startup reason plugin for Flutter

Repository (GitHub)
View/report issues

License

BSL-1.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_startup