SmartApiConfig class
Global, app-wide configuration for smart_api.
Call SmartApiConfig.init once, in main(), before making any calls
through SmartApiClient.instance. Every field below is also readable
directly if you need to inspect the active configuration at runtime.
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- autoDetectFiles ↔ bool
-
Whether
Files and local file paths inside a request body are auto-converted to multipart form data. Defaults totrue; override per-request viaSmartApiRequest.autoDetectFiles.getter/setter pair - baseUrl ↔ String
-
Base URL prepended to every endpoint that doesn't already start
with
http.getter/setter pair - connectTimeout ↔ Duration
-
Timeout for establishing a connection.
getter/setter pair
- enableLogging ↔ bool
-
Whether request/response details are printed via
debugPrint.getter/setter pair -
headerBuilder
↔ Map<
String, dynamic> Function()? -
Builds the headers sent with every request (e.g. an auth token).
Called fresh before each call, so it always reflects the latest
token/session state.
getter/setter pair
- keyMap ↔ SmartApiKeyMap
-
Which JSON keys to look for (success/message/data/etc.) when using
the default response parser instead of a custom responseParser.
getter/setter pair
- receiveTimeout ↔ Duration
-
Timeout for receiving a response after the connection is open.
getter/setter pair
- responseParser ↔ SmartApiEnvelope Function(dynamic json)?
-
Fully custom response parser. When set, this takes priority over
keyMap for turning a raw JSON body into a SmartApiEnvelope.
getter/setter pair
- trustSelfSignedCert ↔ bool
-
Whether to trust self-signed TLS certificates. Only enable this for
local development against a self-signed backend.
getter/setter pair
Static Methods
-
init(
{required String baseUrl, Map< String, dynamic> headerBuilder()?, SmartApiEnvelope responseParser(dynamic json)?, SmartApiKeyMap keyMap = const SmartApiKeyMap(), bool autoDetectFiles = true, Duration? connectTimeout, Duration? receiveTimeout, bool trustSelfSignedCert = false, bool enableLogging = true}) → void -
Configures
smart_apifor the whole app. Call this once, as early as possible inmain(), before anySmartApiClientcall is made.