HttpHelper class
Helpers for working with HTTP
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- client ↔ HttpClient
-
Main HTTP Client
getter/setter pair
Static Methods
-
connectToWebSocket(
String url, {Iterable< String> ? protocols, Map<String, dynamic> ? headers, HttpClient? httpClient, bool? useStandardWebSocket}) → Future<WebSocket> - Custom WebSocket Connection logic.
-
createRequest(
String method, String url, {Map< String, String> ? headers}) → Future<HttpClientRequest> -
Creates an HttpClientRequest with the given parameters.
methodis the HTTP method.urlis the URL to make the request to.headersspecifies additional headers to set. -
fetchJSON(
String url, {Map< String, String> ? headers}) → Future -
Fetches the specified
urlfrom HTTP as json. Ifheadersis specified, the headers will be added onto the request. -
fetchUrl(
String url, {Map< String, String> ? headers}) → Future<String> -
Fetches the specified
urlfrom HTTP. Ifheadersis specified, the headers will be added onto the request. -
readBytesFromResponse(
HttpClientResponse response) → Future< List< int> > -
Reads the entire
responseas a list of bytes. -
tokenizeFieldValue(
String headerValue) → List< String> -
upgradeToWebSocket(
HttpRequest request, [dynamic protocolSelector(List< String> protocols)?, bool? useStandardWebSocket]) → Future<WebSocket>
Constants
- enableStandardWebSocket → const bool