rxbus 0.0.2 rxbus: ^0.0.2 copied to clipboard
A Flutter EventBus using RxDart
FlutterRxBus #
A Flutter EventBus using RxDart
Usage #
1. Add to pubspec.yaml #
rxbus: latest version
2. Define Event #
Any Dart class or List or any Data can be used as an event.
class ChangeTitleEvent {
String title;
ChangeTitleEvent(this.title);
}
3. Register RxBus #
Register RxBus
import 'package:rxbus/rx_bus.dart';
RxBus.singleton.register<ChangeTitleEvent>().listen((event) {
···//do something
print(event.title);
});
4. Send Event #
Register listeners for specific events:
RxBus.singleton.post(ChangeTitleEvent("Changed by event"));
License #
The MIT License (MIT)