FormData.fromMap constructor Null safety

FormData.fromMap(
  1. Map<String, dynamic> map,
  2. [ListFormat collectionFormat = ListFormat.multi]
)

Create FormData instance with a Map.

Implementation

FormData.fromMap(
  Map<String, dynamic> map, [
  ListFormat collectionFormat = ListFormat.multi,
]) {
  _init();
  encodeMap(
    map,
    (key, value) {
      if (value == null) return null;
      if (value is MultipartFile) {
        files.add(MapEntry(key, value));
      } else {
        fields.add(MapEntry(key, value.toString()));
      }
      return null;
    },
    listFormat: collectionFormat,
    encode: false,
  );
}