Buzz
Opinionated modern event-based application development framework.
Built on top of dart-event-bus.
Installation
buzz: 0.1.0
Initialization
Buzz.init(
navigator: MyAppNavigator(),
rootAppRoute: '/',
);
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!'),
)
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);
});
Customization
Include the Buzz events dashboard
First enable the withDebugDashboard
flag from the init
method:
Buzz.init(
withDebugDashboard: true,
navigator: MyAppNavigator(),
rootAppRoute: '/',
);
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,
),
Finally, navigate to the events dashboard by running:
Buzz.fire(GoToBuzzEventsDashboard());
or add a custom button that fires the UiEvent already setup during library initialization:
Buzz.fire(GoToBuzzDashboardButtonTapped());
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
Libraries
- action
- action_model
- actions_bar_view
- app_events
- app_events_page
- buzz
- buzz_event_handler
- buzz_impl
- buzz_registry
- buzz_registry
- buzz_registry
- commands
- commands
- commands
- commands_page
- console_components
- console_entries_view
- console_view
- constants
- dashboard_view_template
- default_methods
- errors
- event_handler
- events
- events
- events_dashboard_page
- feedbacks
- feedbacks_executor
- fire_events_action_bar
- overrides
- page
- repository
- subtype_checker
- ui_events
- ui_events
- ui_page
- utils
- wrappers