ApiMethods class

A utility class for making HTTP GET and POST requests.

The ApiMethods class provides methods to perform HTTP GET and POST requests, with and without authentication tokens. It also includes a static property for setting an API key.

Constructors

ApiMethods.new()

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

getMethod({String? url, Map<String, String>? headers}) Future<(int, Map<String, dynamic>)>
Sends an HTTP GET request to the specified url with optional headers.
getMethodWithToken({String? url, dynamic token}) Future<(int, Map<String, dynamic>)>
Sends an HTTP GET request to the specified url with an authentication token and optional API key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postMethod({String? url, Map<String, String>? headers, dynamic body}) Future<(int, Map<String, dynamic>)>
Sends an HTTP POST request to the specified url with optional headers and request body.
postMethodWithToken({String? url, dynamic token, dynamic body}) Future<(int, Map<String, dynamic>)>
Sends an HTTP POST request to the specified url with an authentication token, request body, and optional API key.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

xApiKey String?
An optional static API key used for requests requiring authentication.
getter/setter pair