ChopperClient class base
ChopperClient is the main class of the Chopper API.
It manages registered services, encodes and decodes data, and intercepts requests and responses.
- Implementers
Constructors
-
ChopperClient({Uri? baseUrl, Client? client, List<
Interceptor> interceptors = const [], Authenticator? authenticator, Converter? converter, ErrorConverter? errorConverter, Iterable<ChopperService> ? services}) - Creates and configures a ChopperClient.
Properties
- authenticator → Authenticator?
-
The Authenticator that can provide reactive authentication for a
request.
final
- baseUrl → Uri
-
Base URL of each request of the registered services.
E.g., the hostname of your service.
final
- converter → Converter?
-
The Converter that handles request and response transformation before
the request and response interceptors are called respectively.
final
- errorConverter → ErrorConverter?
-
The ErrorConverter that handles response transformation before the
response interceptors are called, but only on error responses
(statusCode < 200 || statusCode >= 300).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClient → Client
-
The
http.Client
used to make network calls.final -
interceptors
↔ List<
Interceptor> -
latefinal
-
onRequest
→ Stream<
Request> -
A stream of processed
Request
s, as in after all Converters, and Interceptors have been run.no setter -
onResponse
→ Stream<
Response> -
A stream of processed
Response
s, as in after all Converters and Interceptors have been run.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
delete<
BodyType, InnerType> (Uri url, {Map< String, String> headers = const {}, Map<String, dynamic> parameters = const {}, Uri? baseUrl}) → Future<Response< BodyType> > - Makes a HTTP DELETE request using the send function.
-
dispose(
) → void - Disposes this ChopperClient to clean up memory.
-
get<
BodyType, InnerType> (Uri url, {Map< String, String> headers = const {}, Uri? baseUrl, Map<String, dynamic> parameters = const {}, dynamic body}) → Future<Response< BodyType> > - Makes a HTTP GET request using the send function.
-
getService<
ServiceType extends ChopperService> () → ServiceType - Retrieve any service included in the ChopperClient
-
head<
BodyType, InnerType> (Uri url, {Map< String, String> headers = const {}, Map<String, dynamic> parameters = const {}, Uri? baseUrl}) → Future<Response< BodyType> > - Makes a HTTP HEAD request using the send function.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
options<
BodyType, InnerType> (Uri url, {Map< String, String> headers = const {}, Map<String, dynamic> parameters = const {}, Uri? baseUrl}) → Future<Response< BodyType> > - Makes a HTTP OPTIONS request using the send function.
-
patch<
BodyType, InnerType> (Uri url, {dynamic body, List< PartValue> parts = const [], Map<String, String> headers = const {}, Map<String, dynamic> parameters = const {}, bool multipart = false, Uri? baseUrl}) → Future<Response< BodyType> > - Makes a HTTP PATCH request using the send function.
-
post<
BodyType, InnerType> (Uri url, {dynamic body, List< PartValue> parts = const [], Map<String, String> headers = const {}, Map<String, dynamic> parameters = const {}, bool multipart = false, Uri? baseUrl}) → Future<Response< BodyType> > - Makes a HTTP POST request using the send function
-
put<
BodyType, InnerType> (Uri url, {dynamic body, List< PartValue> parts = const [], Map<String, String> headers = const {}, Map<String, dynamic> parameters = const {}, bool multipart = false, Uri? baseUrl}) → Future<Response< BodyType> > - Makes a HTTP PUT request using the send function.
-
send<
BodyType, InnerType> (Request request, {ConvertRequest? requestConverter, ConvertResponse< BodyType> ? responseConverter}) → Future<Response< BodyType> > - Sends a pre-build Request, applying all provided Interceptors and Converters.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited