zam_event_bus_provider 0.1.0 copy "zam_event_bus_provider: ^0.1.0" to clipboard
zam_event_bus_provider: ^0.1.0 copied to clipboard

outdated

A provider for flutter that passes EventBus down to all the widgets.

Event Bus Provider #

A flutter provider that passes EventBus down to all the widgets.

Version Build Stars License

NOTE: This package is an extension to zam_event_bus.

What's inside the package #

Includes the following core components.

Check out all the components in detail here

How to use #

Step 1: Create an EventBus #

final bus = EventBus(transformers);

EventBus is from zam_event_bus package.

Step 2: Provide the EventBus #

final app = EventBusProvider(
  bus: bus,
  child: MaterialApp(
    home: MyHomePage(title: 'Event Bus Demo'),
  ),
);
runApp(app);  

Add EventBusProvider before MaterialApp so that it is made available to all the routes.

Step 3: Use context to dispatch events #

FloatingActionButton(
  onPressed: () => context.dispatch(IncrementEvent()),
  tooltip: 'Increment',
  child: Icon(Icons.add),
),

Step 4: Use context to listen to values #

context.select<Counter>(), // Gives you a stream of Counter.

To learn more, move on to the example section or check out this dedicated example in github.

Contributors #

0
likes
0
points
4
downloads

Publisher

verified publisherzamstation.com

Weekly Downloads

A provider for flutter that passes EventBus down to all the widgets.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, zam_core, zam_event_bus

More

Packages that depend on zam_event_bus_provider