logError method

void logError({
  1. required dynamic error,
  2. StackTrace? stackTrace,
  3. required String file,
  4. required String event,
})

Logs an error and a stackTrace in a specific file during a specific event.

Implementation

void logError({
  required dynamic error,
  StackTrace? stackTrace,
  required String file,
  required String event,
}) {
  if (kReleaseMode) {
    return;
  }
  stackTrace ??= StackTrace.current;
  log(
    "Error occurred in file $file during event: $event",
    level: _getLevel(error),
    error: error,
    stackTrace: stackTrace,
  );
}