HttpService class

A service for making HTTP requests.

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

get(Uri url, {Duration timeout = const Duration(seconds: 30), Map<String, String>? headers}) Future<Response>
Sends a GET request to the specified url.
getBytes(Uri url, {Duration timeout = const Duration(seconds: 30), Map<String, String>? headers}) Future<(Response, Uint8List)>
Sends a GET request to the specified url and returns the response as a Uint8List.
getCurrentIpAddress() Future<String?>
Returns the current IP address of the device.
getJson(Uri url, {Duration timeout = const Duration(seconds: 30), Map<String, String>? headers}) Future<(Response, dynamic)>
Sends a GET request to the specified url and returns the response as a JSON object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post((Uri, Map<String, String>) composedRequest, {Duration timeout = const Duration(seconds: 30), Map<String, String>? headers}) Future<Response>
Sends a POST request to the specified url.
postBytes((Uri, Map<String, String>) composedRequest, {Duration timeout = const Duration(seconds: 30), Map<String, String>? headers, Encoding? encoding}) Future<(Response, Uint8List)>
Sends a POST request to the specified url and returns the response as a JSON object.
postJson((Uri, Map<String, String>) composedRequest, {Duration timeout = const Duration(seconds: 30), Map<String, String>? headers, Encoding? encoding}) Future<(Response, dynamic)>
Sends a POST request to the specified url and returns the response as a JSON object.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

instance → const HttpService