recordError method

  1. @override
Future<void> recordError({
  1. required String exception,
  2. required String information,
  3. required String reason,
  4. bool fatal = false,
  5. String? buildId,
  6. String? stackTraceElements,
})
override

Submits a Crashlytics report of a caught error.

Implementation

@override
Future<void> recordError({
  required String exception,
  required String information,
  required String reason,
  bool fatal = false,
  String? buildId,
  String? stackTraceElements,
  // List<Map<String, String>>? stackTraceElements,
}) async {
  try {
    await methodChannel.invokeMethod<void>('reportUserException', <String, dynamic>{
      'exception': exception,
      'information': information,
      'reason': reason,
      'fatal': fatal,
      'buildId': buildId ?? '',
      'stackTrace': stackTraceElements ?? [],
    });
  } on PlatformException catch (e, s) {
    // convertPlatformException(e, s);
    var stackTrace = s;
    if (stackTrace == StackTrace.empty) {
      stackTrace = StackTrace.current;
    }

    if (e is! PlatformException) {
      Error.throwWithStackTrace(e, stackTrace);
    }

    Error.throwWithStackTrace(
      Exception('MarvelFlutter#recordError'),
      stackTrace,
    );
  }
}