no_bloc 0.2.1 copy "no_bloc: ^0.2.1" to clipboard
no_bloc: ^0.2.1 copied to clipboard

discontinuedreplaced by: ezbloc_flutter
outdated

Making blocs easy again. A simplified library for the original bloc approach.

example/main.dart

import 'package:no_bloc/no_bloc.dart';

class BroadcastPrinter extends BlocMonitor {
  @override
  void onBroadcast(String blocName, state, {String event}) {
    print('[$blocName] broadcast: $state ($event)');
  }
}

class CounterBloc extends Bloc<CounterBloc, int> {
  CounterBloc() : super(initialState: 0, monitor: BroadcastPrinter());

  // event names are optional and only used for debugging purpose
  void increment() => setState(value + 1, event: 'increment');
  void decrement() => setState(value - 1, event: 'decrement');
}

void main() {
  final bloc = CounterBloc();

  bloc.state.listen((s) => print(s));

  bloc.increment();
  bloc.decrement();
}
6
likes
0
pub points
6%
popularity

Publisher

verified publishermuha.dev

Making blocs easy again. A simplified library for the original bloc approach.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

built_value, equatable, hive, meta, path, pedantic, rxdart, synchronized, test

More

Packages that depend on no_bloc