zam_event_bus 0.9.0 copy "zam_event_bus: ^0.9.0" to clipboard
zam_event_bus: ^0.9.0 copied to clipboard

Event bus is a event based state management package for dart.

Event Bus #

A State Management Package for flutter.

Use it in conjunction with zam_event_bus_provider.

What's inside the package #

Includes the following core components.

Check out all the components in detail here

How to use #

INFO: For flutter usage and providing EventBus to widgets, checkout the zam_event_bus_provider package.

Step 1: Create the bus #

final bus = EventBus([
  EventTransformer.fromFn((HeightSliderDraggedEvent event) => HeightProvidedEvent(event.value)),
  EventTransformer.fromFn((HeightInputTextChangedEvent event) => HeightProvidedEvent(event.value)),
  EventTransformer.fromFn((WeightSliderDraggedEvent event) => WeightProvidedEvent(event.value)),
  EventTransformer.fromFn((WeightInputTextChangedEvent event) => WeightProvidedEvent(event.value)),
  EventTransformer.fromFn((HeightProvidedEvent event) => Bmi.fromHeight(event.value)),
  EventTransformer.fromFn((WeightProvidedEvent event) => Bmi.fromWeight(event.value)),
]);

Step 2: Publish events #

bus.publish(HeightSliderDraggedEvent(1.78));

Step 3: Select and listen to events #

final sub = bus.select<Bmi>().listen((event) => print(event.value)); // prints bmi value

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

Status #

Build

Contributors #

License #

BSD 3-Clause License

0
likes
160
points
28
downloads

Publisher

verified publisherzamstation.com

Weekly Downloads

Event bus is a event based state management package for dart.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

zam_command_pattern, zam_core

More

Packages that depend on zam_event_bus