forceInternetOnOffSimulation property

bool? Function() forceInternetOnOffSimulation
getter/setter pair

If you are running tests, you can change forceInternetOnOffSimulation to simulate the internet connection as ON or OFF for the provided mixins CheckInternet, AbortWhenNoInternet, and UnlimitedRetryCheckInternet.

  • Return true if there IS internet.
  • Return false if there is NO internet.
  • Return null to use the real internet connection status (default).

Example:

store.forceInternetOnOffSimulation = () => false;

This is specially useful during tests, for testing what happens when you have no internet connection. And since it's tied to the store, it automatically resets when the store is recreated.

Implementation

bool? Function() forceInternetOnOffSimulation = () => null;