initialise method
Implementation
Future initialise() async {
setError(null);
setMessage(null);
_error = null;
// We set busy manually as well because when notify listeners is called to clear error messages the
// ui is rebuilt and if you expect busy to be true it's not.
setBusy(true);
notifyListeners();
_data = await runBusyFuture<T?>(futureToRun(), throwException: true)
.catchError((error) {
setError(error);
_error = error;
setBusy(false);
onError(error);
notifyListeners();
if (rethrowException) {
throw error;
}
return null;
});
if (_data != null) {
onData(_data);
}
changeSource = false;
}