flutter_dice
A sample Flutter app that shows how to manage a responsive state using the provider pattern.
Concepts Illustrated
Provider pattern
- Using a provider for global app state (i.e. Theme)
- Using a provider as a view model for a screen
- Using an
MultiProvider
to make the providers accessible - Using
ChangeNotifierProvider<T>
to make the app responsive - Consumption of providers using
Provider.of<T>(context)
method
Persistence
- App and screen state saves when changed and is loaded on startup
- An instance of
SharedPreferences
is created globally as a singleton - Providers are able to save and load their own state
Dynamic Theme
- Can change between light and dark theme.
- Implemented as a provider.
Download flutter dice app source code on GitHub
https://github.com/codegrue/flutter_dice
Provides the list of the opensource Flutter apps collection with GitHub repository.