FormData constructor

FormData(
  1. Map<String, dynamic> map
)

Implementation

FormData(Map<String, dynamic> map) : boundary = _getBoundary() {
  map.forEach((key, value) {
    if (value == null) return;
    if (value is MultipartFile) {
      files.add(MapEntry(key, value));
    } else if (value is List<MultipartFile>) {
      files.addAll(value.map((e) => MapEntry(key, e)));
    } else if (value is List) {
      fields.addAll(value.map((e) => MapEntry(key, e.toString())));
    } else {
      fields.add(MapEntry(key, value.toString()));
    }
  });
}