stream property

  1. @override
Stream<Measurement> get stream
override

The stream of Measurement objects for this StreamProbe. Must be implemented by sub-classes.

Implementation

@override
Stream<Measurement> get stream => _stream ??= ar.ActivityRecognition()
    // On Android the AR plugin runs a foreground service, which is needed
    // for AR events to keep arriving while the app is in the background.
    // The flag is ignored on iOS.
    .activityStream(runForegroundService: true)
    .where((event) => event.type != ar.ActivityType.UNKNOWN)
    .where((event) => event.type != ar.ActivityType.TILTING)
    .where((event) => event.confidence >= minimumConfidence)
    .map((event) => Measurement.fromData(Activity.fromActivityEvent(event)))
    .asBroadcastStream();