dataChanged method
Stream<List<DataEvent> >
dataChanged({
- Uri? pathURI,
- UriFilterType filterType = UriFilterType.literal,
Listen to data change or delete events
Implementation
Stream<List<DataEvent>> dataChanged(
{Uri? pathURI, UriFilterType filterType = UriFilterType.literal}) async* {
await removeDataListener(pathURI: pathURI);
await channel.invokeMethod(
"addDataListener",
pathURI == null
? {"name": "global_data_channel"}
: {"path": pathURI.toString(), "filterType": filterType.index});
String key = pathURI == null ? "global_data_channel" : pathURI.toString();
Map<String, StreamController<List<DataEvent>>> _dataStreamControllers =
_wearOSObserver.streamControllers[ObservableType.data]
as Map<String, StreamController<List<DataEvent>>>;
_dataStreamControllers[key] = StreamController.broadcast();
yield* _dataStreamControllers[key]!.stream;
}