blocx 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

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


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 pub get

Alternatively, your editor might support pub get or flutter pub 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';
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 Apr 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

18 out of 18 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/blocx.dart. (-1.49 points)

Analysis of lib/src/blocx.dart reported 3 hints:

line 17 col 3: The class 'Stream' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 23 col 3: The class 'Stream' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 43 col 7: DO use curly braces for all flow control structures.

Format lib/blocx.dart.

Run dartfmt to format lib/blocx.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (rxdart).

Package is getting outdated. (-27.67 points)

The package was last published 66 weeks ago.


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