FormRequest class base
Wraps an HttpRequest and provides cached access to parsed request input, uploaded files, query parameters, and buffered body data.
FormRequest is responsible for reading the request stream once, buffering
it, and parsing supported body formats into convenient field and file
accessors.
Supported body types:
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Example:
final form = FormRequest(request);
final email = await form.input('email');
final avatar = await form.file('avatar');
Constructors
- FormRequest(HttpRequest _request)
- Creates a form request wrapper for the given HttpRequest.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpRequest → HttpRequest
-
Access to the underlying HttpRequest.
no setter
-
query
→ Map<
String, String> -
Returns only the request query parameters.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
all(
) → Future< Map< String, dynamic> > - Returns all parsed input data merged with query parameters.
-
body(
) → Future< Map< String, dynamic> > - Returns only the parsed body fields.
-
buffer(
) → Future< void> - Reads the request stream and buffers its bytes in memory.
-
file(
String key) → Future< UploadedFile?> -
Returns the uploaded file associated with
key. -
files(
) → Future< Map< String, UploadedFile> > - Returns all uploaded files parsed from the request.
-
input(
String key) → Future - Returns the value for a single input field.
-
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