APIManager class
A singleton class for making API requests
Constructors
- APIManager.getInstance({dynamic baseUrl})
-
static method to return the static singleton instance
factory
Properties
Methods
-
isLoggedIn(
) → Future< bool> - Check if the user is logged in or not
-
login(
String? token) → Future< void> - Save token, will be used throughout the app for authentication
-
logout(
) → Future< void> - Delete the token,
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
request(
String endPoint, {APIMethod method = APIMethod.get, Map? data, bool isAuthenticated = true}) → Future< Response> - Makes the API request here
-
toString(
) → String -
A string representation of this object.
inherited
-
uploadFile(
String endPoint, File file, String fileKey, {Map< String, String> ? data, bool isAuthenticated = true}) → Future<Response> - This method uploads the file
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- client ↔ Client
-
Create http client, used for making API calls
getter/setter pair
Static Methods
-
dispose(
) → dynamic - Dispose the APIManager instance