toJson method Null safety

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  final json = <String, dynamic>{};
  json['type'] = type;
  json.addAll({
    'frames': frames?.map((f) => f.toJson()).toList(),
    'messages': messages?.map((f) => f.toJson()).toList(),
    'truncated': truncated,
  });
  _setIfNotNull(json, 'asyncCausalFrames',
      asyncCausalFrames?.map((f) => f.toJson()).toList());
  _setIfNotNull(
      json, 'awaiterFrames', awaiterFrames?.map((f) => f.toJson()).toList());
  return json;
}