flutter_dice
flutter_dice copied to clipboard
A reference app in flutter using the BLoC pattern.
flutter_dice
A sample Flutter app that shows how to manage responsive state using the leadding state management patterns

Methods Illustrated
BLoC pattern
- Using a BLoC pattern for global app state
- Using the BlocProvider pattern for accessing the model
- Using
BehaviorSubjectmethods to make elements reactive
Provider pattern
- Using a provider for global app state
- Using a provider as a view model for a screen
- Using
ChangeNotifierProvider<T>to make the app reactive - Consumption of providers using
Provider.of<T>(context)method
Riverpod pattern
- Using a
ProviderScopefor global app state - Using a
StateNotifierfor the model for a screen - Using
StateNotifierProviderto make the app reactive - Consumption of providers using
ref.watchandref.readmethod
Singleton Persistence
- App and screen state saves when changed and is loaded on startup
- An instrance of
SharedPreferencesis created globally as a singleton - Providers are able to save and load their own state