initAsync method

  1. @override
  2. @mustCallSuper
Future<bool> initAsync()
inherited

Asynchronous operations must complete successfully.

Implementation

@override
@mustCallSuper
Future<bool> initAsync() async {
  // Always return true. It's got to continue for now.
  const 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) {
        // Note the failure but ignore it
        final e = Exception('${con.runtimeType}.initAsync() returned false!');
        _initAsyncError(e, con);
      }
    } catch (e) {
      // Pass the error to the controller to handle
      _initAsyncError(e, con);
      // Have it handled by an error handler.
      rethrow;
    }
  }
  _setStateAllowed = true;

  /// No 'setState()' functions are necessary
  _setStateRequested = false;

  return init;
}