FormDataRequest extension type

A multipart request containing form data.

The submitted form fields can be accessed through the formData stream:

Future<void> readForm(Request request) {
  if (request.formData() case var form?) {
    await for (final data in form.formData) {
      print(''${formData.name}: ${await formData.part.readString()}'');
    }
  }
}
on
Implemented types

Properties

boundary String
The boundary used to separate parts as part of the body.
no setterinherited
formData Stream<FormData>
Reads invididual form data elements from this request.
no setter
mediaType → MediaType
Return the full media type of the original request, typically something like multipart/mixed; end=$end.
no setterinherited
parts Stream<Multipart>
Reads parts of this multipart request.
no setterinherited
request Request
The underlying request with a multipart body.
no setterinherited

Static Methods

of(Request request) FormDataRequest?
Checks whether request has a multipart boundary and, if so, wraps the request in a MultipartRequest type allowing the individual parts to be accessed.
override