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({
    'id': id,
    'number': number,
    'name': name,
    'isSystemIsolate': isSystemIsolate,
    'isolateFlags': isolateFlags?.map((f) => f.toJson()).toList(),
    'startTime': startTime,
    'runnable': runnable,
    'livePorts': livePorts,
    'pauseOnExit': pauseOnExit,
    'pauseEvent': pauseEvent?.toJson(),
    'libraries': libraries?.map((f) => f.toJson()).toList(),
    'breakpoints': breakpoints?.map((f) => f.toJson()).toList(),
    'exceptionPauseMode': exceptionPauseMode,
  });
  _setIfNotNull(json, 'rootLib', rootLib?.toJson());
  _setIfNotNull(json, 'error', error?.toJson());
  _setIfNotNull(json, 'extensionRPCs', extensionRPCs?.map((f) => f).toList());
  return json;
}