disable method

Future<bool> disable()

Disables background execution.

Returns true if background execution is now disabled, and false if initialize has not succeeded or disabling failed.

Implementation

Future<bool> disable() async {
  if (!_initialized) {
    warning('$runtimeType - Background service is not initialized.');
    return false;
  }

  info('Disabling background service...');
  final disabled = await FlutterBackground.disableBackgroundExecution();
  if (disabled) {
    _enabled = false;
  } else {
    warning('$runtimeType - Failed to disable background service.');
  }
  debug('$runtimeType - Background service disabled: $disabled');
  return disabled;
}