HttpResult class
Result wrapper for HTTP requests with response processing capabilities.
HttpResult provides methods to process HTTP responses in different formats while automatically handling error responses and service errors.
Example
final result = await request('/api/users').get();
// Process as JSON with transformation
final users = await result.json<List>((json) => json['users']);
// Process as streaming data
final stream = await result.stream();
Constructors
- HttpResult(HttpRequest _request)
- Creates an HttpResult for the specified request.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
json<
T> ([T fn(Map< String, dynamic> )?]) → Future<T> - Processes the response as JSON with optional transformation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
stream(
) → Future< ByteStream> - Processes the response as a byte stream.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited