0 purchases
subscribed stream
A utiliy class for easy stream subscription handling
Features #
Create a StreamSubscription Object from a Stream
Transform the event data with the build in callback method
Cache the latest received event data
Getting started #
Recommended use inside BLOC or Provider classes
Usage #
final stream = getRealTimeDataFromDatabase();
final subscribedStream = SubscribedStream<String>(
stream: stream,
onStreamEvent: (data, previousData, subscribedStream) {
if (data != previousData) {
notifyListeners();
}
return data;
},
);
// from UI
final latestValue = subscribedStream.latestValue;
copied to clipboard
Additional information #
Don't hesitate to contact me if you have questions or ideas.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.