cubepod_events 0.1.3 copy "cubepod_events: ^0.1.3" to clipboard
cubepod_events: ^0.1.3 copied to clipboard

A core component of the CubePod Application Runtime. Provides cubepod_events functionalities.

cubepod_events #

Event-driven architecture for CubePod — an event bus and Actor-model state machines.

What's inside #

  • EventBus — pub/sub event bus for decoupled communication between services
  • Actor<S, E> — finite state machine with typed states and typed events

Install #

dependencies:
  cubepod_events: ^0.1.1

Usage #

import 'package:cubepod_events/cubepod_events.dart';

// Event bus
EventBus.emit(UserLoggedIn(userId: '123'));
EventBus.on<UserLoggedIn>((event) => print('Welcome ${event.userId}'));

// Actor (state machine)
final auth = Actor<AuthState, AuthEvent>(initial: AuthState.idle);
auth.on<LoginPressed>((state, event) => AuthState.loading);
auth.on<LoginSuccess>((state, event) => AuthState.authenticated);
auth.send(LoginPressed(email: 'x@y.com', password: '...'));

See cubepod for the full docs.

0
likes
0
points
332
downloads

Publisher

unverified uploader

Weekly Downloads

A core component of the CubePod Application Runtime. Provides cubepod_events functionalities.

License

unknown (license)

More

Packages that depend on cubepod_events