flutter_bloc_generator 0.2.5

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

flutter_bloc_generator

Usage

Add flutter_bloc_generator and build_runner as dev_dependencies to make the build_runner cli and BLoCGenerator available for generation.

dev_dependencies:
  build_runner: <latest_version>
  flutter_bloc_generator: <latest_version>

Output

flutter_bloc_generator outputs a .bloc.dart file in the same directory as the file using the annotations. This file is a part of file that needs to be a part of the original file. To generate the files use build_runners command line package to build out any annotations. E.g.

> flutter packages pub run build_runner build

or to watch for changes:

> flutter packages pub run build_runner watch

Example

A more extensive example can be found in the root example/ directory.

0.2.5

  • Currect trigger types to Future from void
  • Make mappers optionally async

0.2.4

  • Add TriggeredService

0.2.3

  • Allow mappers to return null to not add anything to the output

0.2.2

  • Added paramaters that can be passed to the BLoC and are accessible to BLoC services

0.2.1

  • Make requiring a service require the service type
  • Add BLoCService service that takes an entire BLoC instead of a Stream or Sink

0.2.0

  • Make mappers async

0.1.9

  • Make template value the only current value stored

0.1.8

  • Moved value updater before calling mappers
  • Updating latest values on template

0.1.7

  • OutputService automatic listener
  • OutputService automatic subscription disposer

0.1.6

  • Remove current data from mappers

0.1.5

  • Made services public members

0.1.4

  • Changed Service to InputService and added OutputService

0.1.3

  • Format code
  • Add example

0.1.2

  • Fix latest value updater for initial data

0.1.1

  • Change analyzer dependency to ^0.33.0 for compatability

0.1.0

  • Initial public release

example/example.dart

/// A full example is available a https://github.com/CallumIddon/flutter_bloc_generator/example

// main.dart
import "dart:async";
import "package:flutter/material.dart";
import "package:flutter_bloc_annotations/flutter_bloc_annotations.dart";
import "service.dart";
part "main.bloc.dart";

@BLoC()
@BLoCRequireInputService("TestService", "setCounter")
class _Test {
  @BLoCInput()
  StreamController<int> setCounter = StreamController<int>();

  @BLoCOutput()
  StreamController<int> counter = StreamController<int>();

  @BLoCValue("counter")
  int counterValue;

  @BLoCMapper("setCounter", "counter")
  int setCounterToCounter(int inputData, int currentData) => inputData;
}

// service.dart
import "package:flutter_bloc_annotations/flutter_bloc_annotations.dart";

class TestService extends InputService<int> {
  @override
  void init(Sink<int> sink) async {
    await Future.delayed(Duration(seconds: 10));
    sink.add(10);
  }

  @override
  void dispose() {}
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_bloc_generator: ^0.2.5

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:flutter_bloc_generator/flutter_bloc_generator.dart';
  
Version Uploaded Documentation Archive
0.2.5 Nov 11, 2018 Go to the documentation of flutter_bloc_generator 0.2.5 Download flutter_bloc_generator 0.2.5 archive
0.2.4 Nov 10, 2018 Go to the documentation of flutter_bloc_generator 0.2.4 Download flutter_bloc_generator 0.2.4 archive
0.2.3 Nov 9, 2018 Go to the documentation of flutter_bloc_generator 0.2.3 Download flutter_bloc_generator 0.2.3 archive
0.2.2 Nov 9, 2018 Go to the documentation of flutter_bloc_generator 0.2.2 Download flutter_bloc_generator 0.2.2 archive
0.2.1 Nov 9, 2018 Go to the documentation of flutter_bloc_generator 0.2.1 Download flutter_bloc_generator 0.2.1 archive
0.2.0 Nov 7, 2018 Go to the documentation of flutter_bloc_generator 0.2.0 Download flutter_bloc_generator 0.2.0 archive
0.1.9 Nov 7, 2018 Go to the documentation of flutter_bloc_generator 0.1.9 Download flutter_bloc_generator 0.1.9 archive
0.1.8 Nov 7, 2018 Go to the documentation of flutter_bloc_generator 0.1.8 Download flutter_bloc_generator 0.1.8 archive
0.1.7 Nov 7, 2018 Go to the documentation of flutter_bloc_generator 0.1.7 Download flutter_bloc_generator 0.1.7 archive
0.1.6 Nov 7, 2018 Go to the documentation of flutter_bloc_generator 0.1.6 Download flutter_bloc_generator 0.1.6 archive

All 16 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
14
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
57
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, other

Primary library: package:flutter_bloc_generator/flutter_bloc_generator.dart with components: io, build.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer ^0.33.0 0.33.3
build ^1.0.1 1.0.1
flutter_bloc_annotations ^0.2.5 0.2.5
source_gen ^0.9.0 0.9.1+3
Transitive dependencies
args 1.5.1
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.6
dart_style 1.2.0
flutter 0.0.0
front_end 0.1.6+3
glob 1.1.7
html 0.13.3+3
kernel 0.3.6+3
logging 0.11.3+2
meta 1.1.6
package_config 1.0.5
path 1.6.2
plugin 0.2.0+3
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
utf 0.9.0+5
vector_math 2.0.8
watcher 0.9.7+10
yaml 2.1.15
Dev dependencies
build_runner ^1.1.0