getServiceStatusStream method
Fires when the location Service is manually disabled or enabled.
An instance of LocationServiceStatus
will be emitted each time the
location service is enabled or disabled.
Implementation
@override
Stream<ServiceStatus> getServiceStatusStream() {
if (_serviceStatusStream != null) {
return _serviceStatusStream!;
}
var serviceStatusStream =
_serviceStatusEventChannel.receiveBroadcastStream();
_serviceStatusStream = serviceStatusStream
.map((dynamic element) => ServiceStatus.values[element as int])
.handleError((error) {
_serviceStatusStream = null;
if (error is PlatformException) {
error = _handlePlatformException(error);
}
throw error;
});
return _serviceStatusStream!;
}