http library

Classes

EmptyData
An object representing a state that is empty instead of null.
Request
A class that represents a Request sent during HTTP communication.
Response<D>
The class represents the response from the server.
Serializable

Functions

get<T>(String unencodedPath, {Protocol protocol = Protocol.https, String? service, Map<String, String>? headers, Map<String, dynamic>? parameters, Duration timeout = const Duration(seconds: 10), ResponseDataBuilder<T>? to, ResponseDataAdaptor? adaptor, GetClient? getClient}) Future<Response<T>>
post<T>(String unencodedPath, {Protocol protocol = Protocol.https, String? service, Map<String, String>? headers, Map<String, dynamic>? parameters, Map<String, dynamic>? body, Duration timeout = const Duration(seconds: 10), ResponseDataBuilder<T>? to, PostClient? postClient}) Future<Response<T>>

Typedefs

GetClient = Future<Response> Function(Uri url, {Map<String, String>? headers})
A function type abstracted from http.get, mainly for mocking at test time.
PostClient = Future<Response> Function(Uri url, {Object? body, Encoding? encoding, Map<String, String>? headers})
A function type abstracted from http.post, mainly for mocking at test time.
ResponseDataAdaptor = Map<String, dynamic> Function(dynamic data)
Function to convert response data to an specific structure.
ResponseDataBuilder<T> = T Function(Map<String, Object?> json)
A function type that expresses the function of converting response body to model objects.

Exceptions / Errors

HttpException
This exception indicates that an unexpected error occurred when communicating with the the server.