setRunningStatus method

void setRunningStatus({
  1. required bool isRunning,
  2. required String isRunningKey,
})

Updates the current ActiveController status.

You can use this in ActiveState by calling ActiveState.ifRunning function to show maybe a loading indicator.

You can also access the current state using actively value in ActiveController.

isRunning is a bool value rep Activity running status isRunningKey is a String value rep Activity running status, this value could be used to find the active ActiveController.

activeAsync functions automatically updates actively value.

Implementation

void setRunningStatus(
    {required bool isRunning, required String isRunningKey}) {
  if (_actively != isRunning) {
    if (isRunning) {
      _addIsRunningKey(isRunningKey);
    } else {
      _removeIsRunningKey(isRunningKey);
    }
    _actively = _isRunningKeys.isNotEmpty || isRunning;
    notifyActivities([ActiveStateChanged(isRunning, !isRunning)]);
  }
}