enableBackgroundExecution static method
Enables the execution of the flutter app in the background. You must to call FlutterBackground.initialize() before calling this function.
Returns true if successful, otherwise false. Throws an Exception if the plugin is not initialized by calling FlutterBackground.initialize() first. May throw a PlatformException.
Implementation
static Future<bool> enableBackgroundExecution() async {
if (_isInitialized) {
final success =
await _channel.invokeMethod<bool>('enableBackgroundExecution');
_isBackgroundExecutionEnabled = true;
return success == true;
} else {
throw Exception(
'FlutterBackground plugin must be initialized before calling enableBackgroundExecution()');
}
}