ApiServices class
A service class extending Fetchly for managing API-related functionality.
The ApiServices class provides utilities for setting an authentication
token and performing grouped requests in an efficient manner.
- Inheritance
-
- Object
- ResponseHandler
- Fetchly
- ApiServices
- Implementers
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
-
cancel(
[String? path]) → void -
Cancels an ongoing HTTP request.
inherited
-
check(
Response response, int time, {dynamic onRequest(Request request)?}) → Future< Response> -
A function to check and process an HTTP response.
inherited
-
delete(
String path) → Future< Response> -
Sends a protected DELETE request to the specified
path.override -
fetch(
String method, String path, {Map< String, dynamic> ? query, dynamic data, dynamic onReceiveProgress(int, int)?}) → Future<Response> -
Sends a protected request using
methodto the specifiedpathwith optional parameters.override -
get(
String path, [Map< String, dynamic> ? query]) → Future<Response> -
Sends a protected GET request to the specified
pathwith optionalquery.override -
group(
List< Future< requests) → Future<Response> >List< Response> > - Executes a group of API requests concurrently and returns their responses.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch(
String path, [dynamic data]) → Future< Response> -
Response res = await patch('user/1', {'name': 'John Doe'});inherited -
post(
String path, [dynamic data]) → Future< Response> -
Sends a protected POST request to the specified
pathwith optionaldata.override -
put(
String path, [dynamic data]) → Future< Response> -
Sends a protected PUT request to the specified
pathwith optionaldata.override -
setToken(
String token, {String prefix = 'Bearer'}) → void -
Sets the authentication token for API requests.
override
-
toFile(
String path, {String? filename}) → Future< MultipartFile> -
String path = '/storage/emulated/0/Download/1.jpg'; final file = await toFile(path);inherited -
toString(
) → String -
Override and protected toString method
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited