trackError method

void trackError({
  1. required String message,
  2. String? stackTrace,
  3. String? context,
  4. String? errorCode,
})

Track an error with contextual information.

Implementation

void trackError({
  required String message,
  String? stackTrace,
  String? context,
  String? errorCode,
}) {
  track(
    TelemetryEvent(
      name: 'error',
      type: TelemetryEventType.error,
      properties: {
        'message': message,
        'stackTrace': ?stackTrace,
        'context': ?context,
        'errorCode': ?errorCode,
      },
    ),
  );
}