dependencies: bloc_annotations: <latest_version>
bloc_annotations uses the
BLoCParamater is used.
package:flutter/material.dart needs to be imported when this is used as the generated
cannot have import statements. Any
services that are used also need to be imported.
All the members of your BLoC class that have annotations must be public as the generated code uses
them. Members without annotations can still be used in
@BLoCMapper methods as the member is called
and not copied to the output class.
@BLoCValues initial data will not be copied to the
class and will have no effect on the initial data.
StreamController isn't required so
subjects such as
can be used as shown in the
The output class can be seen in the generated
.bloc.dart file. The
BLoC class defines the inputs
and outputs of the bloc and calls your
@BLoCMappers when somthing is added to the input streams
and adds the output to the output streams. The
BLoC class will also create, initialize and dispose
of any services you require.
Services are automated parts of a
BLoC. They can be inputs, outputs, consume the entire
be a mapper or be triggered manually. You can find all the available services
An extensive example can be found in the root example/ directory.
/// An extensive example is available at https://github.com/CallumIddon/flutter_bloc_generator/example
Add this to your package's pubspec.yaml file:
dependencies: bloc_annotations: ^0.4.0
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.4.0||Jan 1, 2019|
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]
We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
|Dart SDK||>=2.0.0 <3.0.0|