Version: 9.0.7
Testing
#
Cleaning your providersBefore or after each test you will need the default state of all StateNotifier
or Bloc
. So you can use ProvidersContainer.clear();
#
Overriding providersConsider the next provider
Sometimes, for our unit tests or widget tests, we need to mock the behavior of a certain class. In those cases, we can use the overrideCreator
function to override the way our provider creates our notifiers.
Next before your test you can use the setUp
method.