recordError method
Future<void>
recordError(
- Object error,
- StackTrace? stackTrace, {
- String? reason,
- Map<
String, dynamic> ? context, - bool fatal = false,
override
Records error with optional stackTrace and contextual reason.
Set fatal to true for crashes that terminated the app.
Implementation
@override
Future<void> recordError(
Object error,
StackTrace? stackTrace, {
String? reason,
Map<String, dynamic>? context,
bool fatal = false,
}) async {
if (!_enabled) {
return;
}
if (context != null) {
for (final entry in context.entries) {
await _crashlytics.setCustomKey(entry.key, entry.value.toString());
}
}
await _crashlytics.recordError(
error,
stackTrace,
reason: reason,
fatal: fatal,
);
}