recordDartError static method

Future<void> recordDartError(
  1. dynamic exception,
  2. StackTrace stack
)

Callback to catch and report Dart errors, enableCrashReporting() must call before initWithConfig to make it work.

This callback has to be provided when the app is about to be run. It has to be done inside a custom Zone by providing Countly.recordDartError in onError() callback.

void main() { runZonedGuarded<Future

Implementation

static Future<void> recordDartError(exception, StackTrace stack) async {
  log('recordError, Error caught by Countly :');
  if (!_enableCrashReportingFlag) {
    log('recordError, Crash Reporting must be enabled to report crash on Countly', logLevel: LogLevel.WARNING);
    return;
  }
  unawaited(_internalRecordError(exception, stack));
}