built_bloc_generator 0.3.5 copy "built_bloc_generator: ^0.3.5" to clipboard
built_bloc_generator: ^0.3.5 copied to clipboard

outdated

Generates the BLoC boilerplate.

example/example.dart

import 'package:rxdart/rxdart.dart';
import 'package:built_bloc/built_bloc.dart';

part 'example.g.dart';

@bloc
class ExampleBloc extends Bloc with _ExampleBloc {

  ExampleBloc() {
    _add.map((v) => _count.value + v).listen(_count.add);
    //_reset.mapTo(0).listen(_count.add);
  }

  //@BlocStream("total")
  //@BlocSink("setTotal")
  @sink
  @stream
  final BehaviorSubject<int> _count = BehaviorSubject<int>.seeded(0);

  @sink
  final _add = PublishSubject<int>();

  @sink
  @Bind("_onReset")
  final PublishSubject<void> _reset = PublishSubject<void>();

  void _onReset() {
    this._count.add(0);
  }
}
4
likes
0
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

Generates the BLoC boilerplate.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, build_config, built_bloc, code_builder, dart_style, path, source_gen

More

Packages that depend on built_bloc_generator