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.
Class Member Requirements
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.