onControllerError method

void onControllerError(
  1. StateX<StatefulWidget> state,
  2. FlutterErrorDetails details
)
inherited

Step through its Controllers

Implementation

void onControllerError(StateX state, FlutterErrorDetails details) {
  /// You have the option to implement an error handler to individual controllers
  for (final con in state.controllerList) {
    try {
      con.onError(details);
    } catch (e, stack) {
      // Throw in DebugMode.
      if (kDebugMode) {
        // Set the original error routine. Allows the handler to throw errors.
        FlutterError.onError = _prevErrorFunc;
        // Rethrow to be handled by the original routine.
        rethrow;
      } else {
        // Record the error
        recordErrorInHandler(e, stack);

        // Record error in device's log
        _logPackageError(
          e,
          library: 'part04_app_statex.dart',
          description:
              'Error in onControllerError() for ${_consoleNameOfClass(con)}',
        );
      }
    }
  }
}