reportError method

Future<void> reportError(
  1. dynamic ex, {
  2. StackTrace? stack,
  3. String? message,
  4. String? library,
  5. InformationCollector? informationCollector,
})

Report the error in an isolate or in a run zone.

Implementation

Future<void> reportError(
  dynamic ex, {
  StackTrace? stack,
  String? message,
  String? library,
  InformationCollector? informationCollector,
}) async {
  //
  message ??= 'while attempting to run your app';
  library ??= 'Your app';
  // Log on the console
  _logErrorHandlerError(
    ErrorSummary(message),
    ex,
    stack: stack,
    library: library,
    informationCollector: informationCollector,
  );

  try {
    // Designated Reporting feature
    await _errorReport?.call(ex, stack ?? StackTrace.empty);
  } catch (e, stack) {
    // Log on the console
    _logErrorHandlerError(
      ErrorSummary("Error in 'errorReport'"),
      e,
      stack: stack,
    );
  }
}