0 purchases
buzz
Buzz #
Opinionated modern event-based application development framework.
Built on top of dart-event-bus.
Installation #
buzz: 0.1.0
copied to clipboard
Initialization #
Buzz.init(
navigator: MyAppNavigator(),
rootAppRoute: '/',
);
copied to clipboard
Learn more how to create the required instance of the Navigator component.
Fire Events #
By default the framework supports firing three base class events:
UiEvent
Command
NavigationCommand
AppEvent
Find pre-defined out-of-the-box supported events here.
UiEvents #
The library comes with a few pre-defined UiEvents you can find here.
For example, when a button/label is tapped:
ElevatedButton(
onPressed: () {
Buzz.fire(OnTapped());
},
child: Text('Tap me!'),
)
copied to clipboard
Commands #
TODO: Add
AppEvents #
TODO: Add
Listen Events #
Use the on method from the Buzz instance to get a Stream to listen events of a specific class type.
Here is how you can add a listener for NavigationCommand's:
Buzz.on<NavigationCommand>().listen((navigationCommand) {
//TODO: Implement navigation command handler
print(navigationCommand);
});
copied to clipboard
Customization #
Include the Buzz events dashboard #
First enable the withDebugDashboard flag from the init method:
Buzz.init(
withDebugDashboard: true,
navigator: MyAppNavigator(),
rootAppRoute: '/',
);
copied to clipboard
Now you can use the EventsDashboardPage widget. Here is an example on how to declare a route when using Get:
GetPage(
name: EventsDashboardPage.routeName,
page: () => const EventsDashboardPage(),
transition: Transition.fadeIn,
),
copied to clipboard
Finally, navigate to the events dashboard by running:
Buzz.fire(GoToBuzzEventsDashboard());
copied to clipboard
or add a custom button that fires the UiEvent already setup during library initialization:
Buzz.fire(GoToBuzzDashboardButtonTapped());
copied to clipboard
Upcoming Features #
Default navigator using Flutter Navigator 2.0 instead of Get.
Test Coverage #
brew install lcov
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.