recordError static method

void recordError(
  1. dynamic error,
  2. StackTrace? stack, {
  3. String? reason,
  4. bool fatal = false,
})

Manually records a caught error or exception.

Implementation

static void recordError(
  dynamic error,
  StackTrace? stack, {
  String? reason,
  bool fatal = false,
}) {
  final effectiveError = (reason != null && reason.isNotEmpty)
      ? '$error (Reason: $reason)'
      : error;
  scheduleMicrotask(() {
    _captureException(effectiveError as Object, stack ?? StackTrace.current);
  });
}