INNER CODE UNIT · Dart
onEnabledChange
transistorsoft/flutter_background_geolocation · lib/models/background_geolocation.dart:1644
static Subscription onEnabledChange(Function(bool) callback) {
if (_eventsEnabledChange == null) {
_eventsEnabledChange = _eventChannelEnabledChange
.receiveBroadcastStream()
.map((dynamic enabled) => enabled as bool);
}
_registerSubscription(_eventsEnabledChange!.listen(callback), callback);
return Subscription._(() async {
removeListener(callback);
});
}
/// Subscribe to state changes in OS power-saving system.
///
/// Fired when the state of the operating-system's "Power Saving" mode changes. Your `callback` will be provided with a `bool` showing whether "Power Saving" is **enabled** or **disabled**. Power Saving mode can throttle certain services in the background, such as HTTP requests or GPS.
///
/// **NOTE:** You can manually request the current-state of "Power Saving" mode with the method [DeviceSettings.isPowerSaveMode].
///