Last updated:
0 purchases
local pubsub
local_pubsub #
A simple local pubsub library for Dart.
What you can do #
This library allows you to subscribe to different topics and send messages to all subscribers to this topic.
Subscribe to topic
void main() {
PubSub pubsub = PubSub();
Subscription? sub = pubsub?.subscribe('topic');
}
copied to clipboard
Unubscribe to topic
void main() {
PubSub pubsub = PubSub();
Subscription? sub = pubsub?.subscribe('topic');
pubsub?.unsubscribe(sub);
}
copied to clipboard
Publish message for topic
void main() {
PubSub pubsub = PubSub();
Subscription? sub = pubsub?.subscribe('topic');
sub?.stream?.listen((message) {
print(message);
});
pubsub?.publish('topic', 'hello');
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.