WtConfig class

Global, immutable application configuration (the Flutter equivalent of wt_config.php). Initialise once in main() with WtConfig.init.

v1.1 adds the knobs a real backend needs — response envelopes, a bearer token pulled from the session, a logical success flag and request-body sanitisation control — so WtModel works against enveloped/authenticated APIs, not just bare REST endpoints.

Constructors

WtConfig({required String appName, required String baseUrl, required String secretKey, ThemeData? theme, bool debugMode = false, String? envelopeKey, String messageKey = 'msg', String? successKey, String tokenKey = 'token', bool sanitizeRequests = false})
const

Properties

appName String
App display name (MaterialApp title).
final
baseUrl String
API base URL, no trailing slash (e.g. https://findlly.co).
final
debugMode bool
Verbose logging when true.
final
envelopeKey String?
When set, WtModel unwraps response[envelopeKey] before parsing, so an API that replies { "state": true, "data": {...} } is read transparently. Leave null for a bare API that returns the object/array directly.
final
hashCode int
The hash code for this object.
no setterinherited
messageKey String
Key holding a human-readable error message in a failed response body (e.g. msg). Surfaced in WtModelException.message.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sanitizeRequests bool
Client-side sanitisation of request bodies. Off by default: the server is the source of truth (prepared statements / server escaping) and blanket keyword stripping corrupts legitimate content.
final
secretKey String
Shared secret for WtSecurity hashing / session obfuscation.
final
successKey String?
When set, a 2xx response whose body[successKey] is falsy is still treated as a failure (for APIs that return 200 with { "state": false }).
final
theme ThemeData?
Optional Material theme.
final
tokenKey String
Session key under which the bearer token is stored; WtModel injects it as Authorization: Bearer <token> automatically when present.
final

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

instance WtConfig
no setter

Static Methods

init(WtConfig config) → void