setLoading method

void setLoading(
  1. bool value, {
  2. String name = 'default',
  3. bool resetState = true,
})

Set the value of a loading key by padding a true or false

Once the state is disposed only the value is stored, so async work that finishes after its page has closed can still call this.

Implementation

void setLoading(
  bool value, {
  String name = 'default',
  bool resetState = true,
}) {
  if (resetState && mounted) {
    setState(() {
      _loadingMap[name] = value;
    });
  } else {
    _loadingMap[name] = value;
  }
}