lastValueStream property
this stream emits values:
- anytime
read()
is called - anytime
write()
is called - anytime a notification arrives (if subscribed)
- and when first listened to, it re-emits the last value for convenience
Implementation
Stream<List<int>> get lastValueStream => _mergeStreams(
[
WinBle.characteristicValueStreamOf(
address: _address,
serviceId: serviceUuid.str128,
characteristicId: characteristicUuid.str128,
),
FlutterBluePlusWindows._charReadWriteStream
.where((e) => e.$1 == _key)
.map((e) => e.$2)
],
)
.map((p) => <int>[...p])
.newStreamWithInitialValue(lastValue)
.asBroadcastStream();