FirestackClient class

Low-level HTTP client for Firestack API.

Constructors

FirestackClient({required String baseUrl, required String apiKey, Client? httpClient, Duration timeout = const Duration(seconds: 30), int maxRetries = 3, FirestackLogLevel logLevel = FirestackLogLevel.none, void logger(String message)?, String? deviceId, String? appVersion, String? deviceType, String? deviceOs, String? deviceOsVersion})

Properties

apiKey String
final
appVersion String?
getter/setter pair
baseUrl String
final
deviceId String?
Connection/device headers sent with every request.
getter/setter pair
deviceOs String?
getter/setter pair
deviceOsVersion String?
getter/setter pair
deviceType String?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
logger ↔ void Function(String message)?
Custom log function. Defaults to print.
getter/setter pair
logLevel FirestackLogLevel
Log level for debug output.
getter/setter pair
maxRetries int
Max retry attempts for retryable failures (5xx, timeout). 0 = no retries.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
Request timeout. Defaults to 30 seconds.
getter/setter pair
token String?
Get the current bearer token.
no setter

Methods

delete(String path) Future<Map<String, dynamic>>
Make a DELETE request.
dispose() → void
downloadAuthenticatedBytes(String url) Future<Uint8List>
Download file bytes from a URL that requires authentication.
downloadBytes(String url) Future<Uint8List>
Download file bytes from a URL.
get(String path, {Map<String, dynamic>? queryParams}) Future<Map<String, dynamic>>
Make a GET request and return parsed JSON body.
getBytes(String path, {Map<String, dynamic>? queryParams}) Future<Uint8List>
Make a GET request and return the raw response bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(String path, {Map<String, dynamic>? body}) Future<Map<String, dynamic>>
Make a PATCH request with JSON body.
post(String path, {Map<String, dynamic>? body}) Future<Map<String, dynamic>>
Make a POST request with JSON body.
put(String path, {Map<String, dynamic>? body}) Future<Map<String, dynamic>>
Make a PUT request with JSON body.
setConnectionHeaders({String? deviceId, String? appVersion, String? deviceType, String? deviceOs, String? deviceOsVersion}) → void
Set connection/device headers that the backend uses for analytics and connection monitoring. See SDK_INTEGRATION_GUIDE.md in the Firestack backend for the expected header semantics.
setToken(String? token) → void
Set the bearer token for authenticated requests.
toString() String
A string representation of this object.
inherited
uploadFile(String path, {required String filePath, required Uint8List fileBytes, String? visibility, String? category, Map<String, String>? metadata}) Future<Map<String, dynamic>>
Upload a file via multipart POST.

Operators

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