toJson method Null safety

Map toJson()

Implementation

Map toJson(){
  Map result = {};

  if (fields != null) result.addAll({"fields": fields});

  return result;
}