This project is an extension of the Write your first Flutter app tutorial provided by the Flutter team, which generates random words that can be favored. This project aims to show how to manage the state of a Flutter app using state management techniques such as Vanilla Provider
and BloC
.
The vanilla Provider approach involves using the Provider package to manage the application's state. In this project, we show how to use ChangeNotifier and Consumer to update the app's state.
git checkout tags/appstate
The BloC (Business Logic Component) approach involves separating the business logic of the app from the UI. In this project, we show how to use BloC to manage the app's state. We use flutter_bloc
8.0+ version, which optimizes the event handler convention. The BloC
state management is on the main
branch.
We use bloc_test to write unit tests for BloC
.
Since we uses mockito, generate the mock files before running the tests:
flutter pub run build_runner build
To run test coverage, try the following:
flutter test --coverage; genhtml coverage/lcov.info -o coverage/html; open coverage/html/index.html
Widget and Integration tests are another essential part of app development. In this project, we show how to write Widget and Integration tests for the BloC
approach.
Flutter 3.7.9 • channel stable