toJsonMap method Null safety

Map<String, Object?> toJsonMap()

Implementation

Map<String, Object?> toJsonMap() {
  final map = <String, Object?>{};
  for (final field in fields) {
    map[field.key] = field.toJson()['value'];
  }
  return map;
}