locationStream property

Stream<Location> get locationStream

Stream of location updates.

Example with Riverpod:

final locationProvider = StreamProvider.autoDispose((ref) {
  return Locus.locationStream;
});

Example with BLoC:

Locus.locationStream.listen((location) {
  emit(LocationLoaded(location));
});

Implementation

static Stream<Location> get locationStream {
  return events
      .where((event) => event.type == EventType.location)
      .map((event) => event.data)
      .where((data) => data is Location)
      .cast<Location>();
}