hydrated_cubit 0.2.0-dev.1 copy "hydrated_cubit: ^0.2.0-dev.1" to clipboard
hydrated_cubit: ^0.2.0-dev.1 copied to clipboard

discontinued
outdated

An extension to the cubit state management library which automatically persists and restores cubit states.

Cubit

Pub build coverage Star on GitHub Discord License: MIT Starware

An extension to the cubit state management library which automatically persists and restores cubit states.

Creating a HydratedCubit #

class CounterCubit extends HydratedCubit<int> {
  CounterCubit() : super(0);

  void increment() => emit(state + 1);
  void decrement() => emit(state - 1);

  @override
  int fromJson(Map<String, dynamic> json) => json['value'] as int;

  @override
  Map<String, int> toJson(int state) => {'value': state};
}

Using a HydratedCubit #

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  HydratedCubit.storage = await HydratedStorage.build();
  final counterCubit = CounterCubit();
}

Dart Versions #

  • Dart 2: >= 2.7.0

Maintainers #

Supporters #

Very Good Ventures

Starware #

HydratedCubit is Starware.
This means you're free to use the project, as long as you star its GitHub repository.
Your appreciation makes us grow and glow up. ⭐

5
likes
40
pub points
0%
popularity

Publisher

verified publisherbloc-dev.com

An extension to the cubit state management library which automatically persists and restores cubit states.

Repository (GitHub)
View/report issues
Contributing

License

MIT (LICENSE)

Dependencies

cubit, flutter, hive, meta, path_provider, synchronized

More

Packages that depend on hydrated_cubit