getLocationUpdates static method

StreamController<Location>? getLocationUpdates(
  1. void location(
    1. Location
    )
)

Register a function to receive location updates as long as the location service has started

Implementation

static StreamController<Location>? getLocationUpdates(void Function(Location) location) {
  if (locationCallbackStream?.isClosed == false) {
    locationCallbackStream?.close();
  }

  locationCallbackStream = StreamController();
  locationCallbackStream?.stream.listen(location);
  return locationCallbackStream;
}