watchState method

  1. @override
Stream<TwinPlatformState> watchState()
override

Emits the current state as soon as it is known, then every change.

Several listeners may subscribe at once. Platforms without native support emit TwinPlatformState.fallback.

Implementation

@override
Stream<TwinPlatformState> watchState() async* {
  final TwinPlatformState? last = _last;
  if (last != null) yield last;
  yield* _controller.stream;
}