ServerRequest class final

Platform-neutral incoming request.

Constructors

ServerRequest({required HttpMethod method, required Uri uri, Headers? headers, Stream<List<int>>? body, Future<void>? cancelled})
Creates a request from its method, URI, headers, and body stream.
ServerRequest.bytes({required HttpMethod method, required Uri uri, Headers? headers, List<int> body = const <int>[], Future<void>? cancelled})
Creates a request whose body is already buffered.
factory

Properties

body → Stream<List<int>>
The request body chunks.
final
cancelled → Future<void>?
Completes when the caller cancels or an adapter observes disconnection.
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Headers
The request headers.
final
method → HttpMethod
The request method.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
uri → Uri
The requested URI.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readBytes({int maxBytes = 10 * 1024 * 1024}) → Future<Uint8List>
Reads and buffers the body, up to maxBytes.
readJson({int maxBytes = 10 * 1024 * 1024}) → Future<Object?>
Reads and decodes a JSON body.
readText({int maxBytes = 10 * 1024 * 1024, Encoding encoding = utf8}) → Future<String>
Reads the body as text using encoding.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited