ImageApi class
A class that provides methods to interact with an image API.
This class allows uploading images, listing images, and retrieving dynamic or static image objects.
Example usage:
final imageApi = ImageApi(
baseUrl: "https://example.com/api",
generateToken: () async => "your_token",
);
Constructors
-
ImageApi.new({required String baseUrl, required Future<
String> generateToken()}) -
Constructs an ImageApi instance with the given
baseUrl
andgenerateToken
.
Properties
- baseUrl → String
-
The base URL of the image API.
final
-
generateToken
→ Future<
String> Function() -
A function that generates an authentication token for API requests.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- listUrl → String
-
Returns the URL for listing images.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uploadUrl → String
-
Returns the URL for uploading images.
no setter
Methods
-
getDynamicImage(
String imgName) → DynamicApiImage -
Retrieves a DynamicApiImage object for the given
imgName
. -
getStaticImage(
String imgName) → StaticApiImage -
Retrieves a StaticApiImage object for the given
imgName
. -
getToken(
) → Future< String> - Generates an authentication token and returns it as a query parameter.
-
getToken2(
dynamic S) → Future< String> - Generates an authentication token and returns it as a query parameter.
-
listDynamicImages(
) → Future< List< DynamicApiImage> > - Lists all dynamic images available in the API.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
upload(
Uint8List uploadedImage) → Future< DynamicApiImage> - Uploads an image to the API.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited