extended_bloc

A predictable state management library that helps implement the BLoC design pattern

WTFPL License

Stars
5

Extended BLoC

EnumBloc<Event, State>

BLoC with primitive events.

Override [router] and create generators.

Example usage:

class MyEnumBloc extends EnumBloc<Event, State> {

  MyEnumBloc() : super(State.initial);

  @override
  Map<Event, Function> get router =>
    <Event, Function>{
      Event.read : _read,
    };

  Stream<MockState> _read() async* {
    yield State.performing;
    // ...
    yield State.fetched;
  }
}

RouterBloc<Event, State>

BLoC with complex events, containing internal data.

Override [router] and create generators.

Example usage:

class MyRouterBloc extends RouterBloc<Event, State> {

  MyRouterBloc() : super(InitialState());

  @override
  Map<Type, Function> get router =>
    <Type, Function>{
      PerformEvent : _perform,
    };

  Stream<State> _perform(PerformEvent event) async* {
    yield PerformingState();
    // ...
    yield PerformedState();
  }
}

Coverage

Changelog

Refer to the Changelog to get all release notes.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Maintainers

Plague Fox

License

WTFPL

Package Rankings
Top 30.89% on Pub.dev
Badges
Extracted from project README
Actions Status Coverage Pub License: WTFPL effective_dart