toMap method

Map<String, dynamic> toMap()

Returns the serialized map (prefer sanitized payload when present).

Implementation

Map<String, dynamic> toMap() =>
    _payload ??
    <String, dynamic>{
      'id': id,
      'timestamp': timestamp.toIso8601String(),
      'handled': handled,
      'exception': <String, dynamic>{
        'type': exception.runtimeType.toString(),
        'userMessage': exception.userMessage,
        'devMessage': exception.devMessage,
        'severity': exception.severity.name,
        'metadata': exception.metadata,
        if (exception.cause != null) 'cause': exception.cause.toString(),
        if (exception.stack != null) 'stack': exception.stack.toString(),
      },
      'context': context,
      if (fingerprints.isNotEmpty) 'fingerprints': fingerprints,
      if (breadcrumbs.isNotEmpty)
        'breadcrumbs': breadcrumbs.map((b) => b.toMap()).toList(),
      if (attachments.isNotEmpty)
        'attachments': attachments.map((a) => a.toMap()).toList(),
    };