blocx 0.1.2

Dart native js
Flutter Android iOS web

BLoC pattern implementation which help with reducing boilerplate which comes with writing traditional BLoC pattern.

BloCX #

BLoC pattern implementation which simplifies process of writing BLoC and minimizes boilerplate which is needed to be written with traditional BLoC pattern implementation.

Usage #

First we need to define actions and state

Actions

abstract CounterAction{

}

class IncrementCounterAction extends CounterAction{
}

State

class CounterState {
  int counter;

  CounterState() : this.counter = 0;
}

Then we implement BloC as follows

class CounterBloc extends Bloc<CounterAction, CounterState> {
  @override
  CounterState get initialState => CounterState();

  @override
  CounterState updateState(CounterState state, CounterAction action) {
    switch (action.runtimeType) {
      case IncrementCounterAction:
        return state..counter = state.counter + 1;
        break;
    }
    return state;
  }
}
0
likes
80
pub points
7%
popularity

BLoC pattern implementation which help with reducing boilerplate which comes with writing traditional BLoC pattern.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

programmerguy92@gmail.com

License

MIT (LICENSE)

Dependencies

rxdart

More

Packages that depend on blocx