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
- buzz
- buzz_impl
- constants
- event_dashboard/action_bar/action_model
- event_dashboard/action_bar/actions_bar_view
- event_dashboard/action_bar/fire_events_action_bar
- event_dashboard/action_bar/overrides
- event_dashboard/action_bar/repository
- event_dashboard/app_events_page
- event_dashboard/buzz_registry
- event_dashboard/commands_page
- event_dashboard/components/dashboard_view_template
- event_dashboard/console/console_components
- event_dashboard/console/console_entries_view
- event_dashboard/console/console_view
- event_dashboard/events_dashboard_page
- event_dashboard/ui_events
- event_dashboard/ui_page
- event_dashboard/utils/default_methods
- feedbacks/buzz_registry
- feedbacks/commands
- feedbacks/event_handler
- feedbacks/events
- feedbacks/feedbacks
- feedbacks/feedbacks_executor
- framework/actions/action
- framework/pages/page
- infra/buzz_event_handler
- infra/errors
- kinds/app_events
- kinds/commands
- kinds/ui_events
- navigation/buzz_registry
- navigation/commands
- navigation/events
- utils/subtype_checker
- utils/utils
- wrappers