toJson method

Map<String, dynamic> toJson()

Converts this breadcrumb to a map that can be serialized to JSON according to the Sentry protocol.

Implementation

Map<String, dynamic> toJson() {
  final json = <String, dynamic>{
    'timestamp': formatDateAsIso8601WithMillisPrecision(timestamp),
  };

  if (message != null) {
    json['message'] = message;
  }
  if (category != null) {
    json['category'] = category;
  }
  if (data?.isNotEmpty ?? false) {
    json['data'] = data;
  }
  if (level != null) {
    json['level'] = level!.name;
  }

  if (type != null) {
    json['type'] = type;
  }
  return json;
}