FormData class

Container for multipart form data.

FormData allows you to build multipart/form-data requests by adding fields and files. This is commonly used for file uploads and forms with mixed content types.

Example

final formData = FormData()
  ..addField('name', 'John Doe')
  ..addField('email', 'john@example.com')
  ..addFile(await http.MultipartFile.fromPath('avatar', '/path/to/image.jpg'));

final response = await request('https://api.calljmp.com/upload')
  .post(formData)
  .json();

Constructors

FormData()

Properties

fields Map<String, Object>
Returns an unmodifiable view of the form fields and files.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addField(String key, String value) → void
Adds a text field to the form data.
addFile(MultipartFile file) → void
Adds a file to the form data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited