initAsyncState method

  1. @override
Future<bool> initAsyncState(
  1. covariant State<StatefulWidget> state
)
override

Called with every StateX associated with this Controller Initialize any 'time-consuming' operations at the beginning. Implement any asynchronous operations needed done at start up.

Implementation

@override
Future<bool> initAsyncState(covariant State state) async {
  final init = super.initAsyncState(state);
  // Optionally call super for debugPrint()
  assert(() {
    // Impose a print if the State prints
    if (state is StateX && state._debugPrintEvents) {
      // Use debugPrint() to print out to the console when an event fires
      debugPrintEvents = state._debugPrintEvents;
    }
    if (_debugPrintEvents) {
      debugPrint(
          '$_consoleLeadingLine initAsyncState($state) in $_consoleClassName');
    }
    return true;
  }());
  return init;
}