blocx 0.1.2

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

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]
3
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
51
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

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 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 points)

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

line 17 col 3: The class 'Stream' was not 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' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

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 0.21.0