toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final localJson = json;
  final result = localJson == null
      ? <String, dynamic>{}
      : Map<String, dynamic>.of(localJson);
  result['type'] = type;
  return result;
}