ezbloc 5.0.8 copy "ezbloc: ^5.0.8" to clipboard
ezbloc: ^5.0.8 copied to clipboard

discontinuedreplaced by: flutter_state_management

Make bloc easy again! A simple and low boilerplate implementation of the bloc state management pattern. Includes extras to work with blocs like testing, monitoring and persistence.

example/main.dart

import 'package:ezbloc/ezbloc.dart';

class BroadcastPrinter extends BlocMonitor {
  @override
  void onBroadcast(bloc, state, {String? event}) {
    print('[$bloc] broadcast: $state ($event)');
  }
}

final class CounterBloc extends Bloc<int> {
  CounterBloc() : super(initialState: 0, monitor: BroadcastPrinter());

  // event names are optional and only used for debugging purpose
  void increment() => setState(state + 1, event: 'increment');

  void decrement() => setState(state - 1, event: 'decrement');
}

void main() {
  final bloc = CounterBloc();

  bloc.stream.listen((s) => print(s));

  bloc.increment();
  bloc.decrement();
}
3
likes
0
pub points
19%
popularity

Publisher

verified publishermuha.dev

Make bloc easy again! A simple and low boilerplate implementation of the bloc state management pattern. Includes extras to work with blocs like testing, monitoring and persistence.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

hive, meta, path, pedantic, quick_log, rxdart, stack_trace, test

More

Packages that depend on ezbloc