A Flutter EventBus using RxDart
rxbus: latest version
Any Dart class or List or any Data can be used as an event.
class ChangeTitleEvent {
String title;
ChangeTitleEvent(this.title);
}
Register RxBus
import 'package:rxbus/rx_bus.dart';
RxBus.singleton.register<ChangeTitleEvent>().listen((event) {
···//do something
print(event.title);
});
Register listeners for specific events:
RxBus.singleton.post(ChangeTitleEvent("Changed by event"));
@override
void dispose() {
RxBus.destroy();
super.dispose();
}
The MIT License (MIT)