registerFallbackValue function Null safety

void registerFallbackValue(
  1. dynamic value

Allows any and captureAny to be used on parameters of type value.

It is necessary for tests to call registerFallbackValue before using any/captureAny because otherwise it would not be possible to assign any/captureAny as value to a non-nullable parameter.

Mocktail comes with already pre-registered values, for types such as int, String and more.

Once registered, a value cannot be unregistered, even when using resetMocktailState.

It is a good practice to create a function shared between all tests that calls registerFallbackValue with various types used in the project.


void registerFallbackValue(dynamic value) => _fallbackValues.add(value);