HttpLink class

A simple HttpLink implementation.

To use non-standard Request and Response shapes you can override serializeRequest, parseResponse, parseError and parseLocation.

To customize the request headers you can pass a custom http.Client to the constructor.

Inheritance

Constructors

HttpLink(String uri, {Map<String, String> defaultHeaders = const {}, bool useGETForQueries = false, Client? httpClient, RequestSerializer serializer = const RequestSerializer(), ResponseParser parser = const ResponseParser(), HttpResponseDecoder httpResponseDecoder = _defaultHttpResponseDecode, bool followRedirects = false})
Construct the Link

Properties

defaultHeaders → Map<String, String>
Default HTTP headers
final
followRedirects → bool
final
hashCode → int
The hash code for this object.
no setterinherited
httpResponseDecoder ↔ HttpResponseDecoder
A function that decodes the incoming http response to Map<String, dynamic>, the decoded map will be then passes to the RequestSerializer. It is recommended for performance to decode the response using compute function.
getter/setter pair
parser → ResponseParser
Parser used to parse response
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serializer → RequestSerializer
Serializer used to serialize request
final
uri → Uri
Endpoint of the GraphQL service
final
useGETForQueries → bool
set to true to use the HTTP GET method for queries (but not for mutations)
final

Methods

concat(Link next) → Link
Adds next after this link
inherited
dispose() → Future<void>
Closes the underlining http.Client
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request(Request request, [NextLink? forward]) → Stream<Response>
A function called when a request reaches this Link
override
route(LinkRouter route) → Link
Route requests after this link
inherited
split(bool test(Request request), Link left, [Link right = const PassthroughLink()]) → Link
Split requests after this link
inherited
toString() → String
A string representation of this object.
inherited

Operators

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