blocx 0.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 66

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.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/main.dart

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

void main() {
  CounterBloc bloc = CounterBloc();
  bloc.dispatch(IncrementCounterAction());
}

Use this package as a library

1. Depend on it

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


dependencies:
  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
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
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

Platforms

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.

Dependencies

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