initAsync method
Asynchronous operations must complete successfully.
Implementation
@override
@mustCallSuper
Future<bool> initAsync() async {
//
bool init = true;
// No 'setState()' functions are allowed to fully function at this point.
_setStateAllowed = false;
for (final con in _controllerList) {
//
try {
final _init = await con.initAsync();
if (!_init) {
// All were not successful.
init = false;
}
} catch (e) {
//
final details = FlutterErrorDetails(
exception: e,
stack: e is Error ? e.stackTrace : null,
library: 'state_extended.dart',
context: ErrorDescription('${con.runtimeType}.initAsync'),
);
// To cleanup and recover resources.
con.onAsyncError(details);
// Have it handled by an error handler.
rethrow;
}
}
_setStateAllowed = true;
/// No 'setState()' functions are necessary
_setStateRequested = false;
return init;
}