zam_event_bus

Creator: coderz1093

Last updated:

0 purchases

zam_event_bus Image
zam_event_bus Images

Languages

Categories

Add to Cart

Description:

zam event bus

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.

EventBus
EventTransformer

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)),
]);
copied to clipboard
Step 2: Publish events #
bus.publish(HeightSliderDraggedEvent(1.78));
copied to clipboard
Step 3: Select and listen to events #
final sub = bus.select<Bmi>().listen((event) => print(event.value)); // prints bmi value
copied to clipboard
To learn more, move on to the example section or check out these dedicated examples in github.
Status #

Contributors #

Amsakanna

License #
BSD 3-Clause License

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.