form_data 0.0.1
form_data: ^0.0.1 copied to clipboard

Dart native js
Flutter Android iOS web

multipart/form-data builder for Dart aiming to be compatible with RFC 7578.

#

Pub Version RFC

Content-Type: multipart/form-data builder for Dart aiming to be compatible with RFC 7578.

API documentation is available here.

Installation #

Add form_data to your pubspec.yaml and run pub get or flutter pub get.

dependencies:
  form_data: ^0.0.1-nullsafety.1

Usage #

Instantinate FormData class and add fields using add and addFile methods.

var formData = FormData();

formData.add('name', 'Name Surname');
formData.add('answer', 42);
formData.addFile('file', await File('picture.png').readAsBytes(),
  filename: 'myPicture.png', contentType: 'image/png');

Extract data using body, contentType and contentLength headers.

var request = client.postUrl(myUri);

request.headers.set('Content-Type', formData.contentType);
request.headers.set('Content-Length', formData.contentLength);

request.add(formData.body);

await request.close();
0
likes
110
pub points
24%
popularity

multipart/form-data builder for Dart aiming to be compatible with RFC 7578.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

artur.wojciechowski@pubnub.com

License

MIT (LICENSE)

More

Packages that depend on form_data