cubit 0.0.1 copy "cubit: ^0.0.1" to clipboard
cubit: ^0.0.1 copied to clipboard

discontinuedreplaced by: bloc
outdated

An experimental Dart library which expose a cubit. A cubit is a reimagined bloc (from package:bloc) which removes events and relies on methods to emit new states instead.

example/main.dart

import 'package:cubit/cubit.dart';

void main() async {
  final counterCubit = CounterCubit()..listen(print);

  await counterCubit.increment();
  await counterCubit.increment();
  await counterCubit.increment();

  await counterCubit.decrement();
  await counterCubit.decrement();
  await counterCubit.decrement();
}

class CounterCubit extends Cubit<int> {
  @override
  int get initialState => 0;

  Future<void> increment() => emit(state + 1);
  Future<void> decrement() => emit(state - 1);
}
118
likes
0
pub points
66%
popularity

Publisher

verified publisherbloc-dev.com

An experimental Dart library which expose a cubit. A cubit is a reimagined bloc (from package:bloc) which removes events and relies on methods to emit new states instead.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on cubit