blocx 0.1.2

  • Example
  • Installing
  • Versions
  • 66


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


First we need to define actions and state


abstract CounterAction{


class IncrementCounterAction extends CounterAction{


class CounterState {
  int counter;

  CounterState() : this.counter = 0;

Then we implement BloC as follows

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

  CounterState updateState(CounterState state, CounterAction action) {
    switch (action.runtimeType) {
      case IncrementCounterAction:
        return state..counter = state.counter + 1;
    return state;

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.


import 'counter_actions.dart';
import 'counter_bloc.dart';

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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  blocx: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:blocx/blocx.dart';
Version Uploaded Documentation Archive
0.1.2 Dec 28, 2018 Go to the documentation of blocx 0.1.2 Download blocx 0.1.2 archive
0.1.0 Dec 13, 2018 Go to the documentation of blocx 0.1.0 Download blocx 0.1.0 archive
0.0.3 Dec 13, 2018 Go to the documentation of blocx 0.0.3 Download blocx 0.0.3 archive
0.0.2 Dec 13, 2018 Go to the documentation of blocx 0.0.2 Download blocx 0.0.2 archive
0.0.1 Dec 13, 2018 Go to the documentation of blocx 0.0.1 Download blocx 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.10


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:blocx/blocx.dart.

Health issues and suggestions

Document public APIs. (-1 points)

18 out of 18 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/blocx.dart.

Run dartfmt to format lib/blocx.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
rxdart ^0.20.0 0.20.0