HTTPClientAdapter class

High-level HTTP client shared across the Flutter SDK.

Usage:

HTTPClientAdapter.shared.configure(
  baseURL: 'https://api.runanywhere.ai',
  apiKey: '...',
  environment: SDKEnvironment.SDK_ENVIRONMENT_PRODUCTION,
);
final resp = await HTTPClientAdapter.shared.post(
  '/api/v1/devices/register',
  body: {'device_id': 'abc'},
);

Properties

accessToken String?
no setter
apiKey String
no setter
baseURL String
no setter
environment SDKEnvironment
no setter
hashCode int
The hash code for this object.
no setterinherited
isConfigured bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supabaseKey String
no setter

Methods

configure({required String baseURL, required String apiKey, SDKEnvironment environment = SDKEnvironment.SDK_ENVIRONMENT_PRODUCTION, int timeoutMs = defaultTimeoutMs}) → void
configureDev({required String supabaseURL, required String supabaseKey}) → void
delete(String path, {Map<String, String>? headers, bool requiresAuth = false, int? timeoutMs}) Future<HttpClientResponse>
get(String path, {Map<String, String>? headers, bool requiresAuth = false, int? timeoutMs}) Future<HttpClientResponse>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(String path, {Object? body, Map<String, String>? headers, bool requiresAuth = false, int? timeoutMs}) Future<HttpClientResponse>
put(String path, {Object? body, Map<String, String>? headers, bool requiresAuth = false, int? timeoutMs}) Future<HttpClientResponse>
rawRequest({required String method, required String url, Map<String, String>? headers, Uint8List? body, int? timeoutMs, bool followRedirects = true}) Future<HttpClientResponse>
Low-level raw request. Caller owns URL + headers + body.
send({required String method, required String path, Map<String, String>? headers, Object? body, bool requiresAuth = false, int? timeoutMs, bool followRedirects = true}) Future<HttpClientResponse>
Send a request resolving SDK URL / auth / default header rules.
setRefreshCallback(Future<String?> onRefresh()) → void
Hook invoked after a 401 to let the auth bridge refresh the token and return a new one.
setToken(String? token) → void
setTokenResolver(Future<String?> resolver({required bool requiresAuth})) → void
Wire in a token resolver so requiresAuth: true requests can trigger token refresh without this adapter importing the auth bridge directly.
shutdown() → void
Clear every lifetime-scoped endpoint, credential, and auth callback.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

shared HTTPClientAdapter
final

Constants

defaultTimeoutMs → const int