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
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