Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

are/form_data

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧾 package:form_data

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: ^1.0.0-nullsafety.1

Usage

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

var formData = FormData();

formData.add('name', 'Name Surname');
formData.add('answer', 42);
formData.addBytes('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();

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.