LikeConfig class

Global configuration for the LIKE engine's behavior and caching system.

Constructors

LikeConfig({required String projectName, LikeAuthConfig? authConfig, LikeToastConfig? toastConfig, String baseUrl = '', LikeDataUnpacker unpacker = const DefaultLikeUnpacker(), Map<String, String> extraBaseUrls = const {}, Map<String, String> defaultHeaders = const {}, Duration connectTimeout = const Duration(seconds: 30), Duration receiveTimeout = const Duration(seconds: 30), Duration sendTimeout = const Duration(seconds: 30), Duration initTimeout = const Duration(seconds: 15), Duration connTimeout = const Duration(seconds: 5), int connDebounceMs = 500, bool enableLogging = true, bool silentConsole = false, bool silentSyncLogs = false, bool compactApiLogs = false, bool silentApiStartLogs = false, bool disableFileLogging = false, bool verboseLogging = false, List<String> sensitiveHeaders = const ['Authorization', 'Cookie', 'Set-Cookie'], int computeThresholdKB = 100, bool? verifySSL, String sslCertSha256 = '', bool cacheEnabled = true, bool staleWhileRevalidateEnabled = true, bool deduplicateEnabled = true, bool perfTrackingEnabled = true, bool rateLimitEnabled = true, bool autoRetryRateLimit = true, bool mockEnabled = false, bool throttleEnabled = true, bool silentRefreshEnabled = true, bool cacheOnOffline = false, bool cacheOnError = false, bool cacheOnException = false, int maxAutoRetries = 3, List<int> retryDelays = const [1, 2, 4], bool automaticConnectivityChecksEnabled = true, Duration automaticFailureCheckCooldown = const Duration(seconds: 3), bool offlineSyncEnabled = true, bool backgroundSyncEnabled = true, bool withAuthByDefault = true, bool offlineSyncByDefault = false, bool disableCacheByDefault = false, bool disableLoggerByDefault = false, bool suppressErrorsByDefault = false, bool staleWhileRevalidateByDefault = false, bool sessionStaleByDefault = false, bool singleFetchByDefault = false, bool refreshByDefault = false, bool bottomRefreshByDefault = false, bool healthCheckByDefault = false, bool deduplicateByDefault = true, int cacheTTL = 7, int maxL1CacheItems = 200, int maxInFlightRequests = 100, int sessionStaleTTL = 5, int imageStalePeriod = 90, int maxImageCacheItems = 5000, double maxImageCacheMB = 500.0, double minImageCacheMB = 400.0, String? boxApiCache, String? boxOfflineQueue, String? boxCacheMetadata, String? boxEtags, String connCheckHost = 'google.com', bool supportWeb = false, List<Interceptor> interceptors = const []})

Properties

authConfig → LikeAuthConfig?
Optional global authentication configuration (token getters, refresh, logout callbacks).
final
automaticConnectivityChecksEnabled → bool
Enables background connectivity checks after ambiguous terminal transport failures.
final
automaticFailureCheckCooldown → Duration
Minimum delay between automatic failure-triggered checks for one origin.
final
autoRetryRateLimit → bool
Automatically handles "Too Many Requests" (HTTP 429) errors from the server.
final
backgroundSyncEnabled → bool
Allows background sync tasks to run even when the user closes or minimizes the app.
final
baseUrl → String
The main web address (API root URL) that your app talks to.
final
bottomRefreshByDefault → bool
Displays a subtle pagination-friendly loading indicator (like a bottom spinner) instead of a full-screen loading spinner.
final
boxApiCache → String
The storage box table name used for general API response cache payloads.
final
boxCacheMetadata → String
The storage box table name used for caching timestamps, expiration dates, and metadata.
final
boxEtags → String
The storage box table name used for storing ETag markers to support 304 response validations.
final
boxOfflineQueue → String
The storage box table name used for queueing failed mutations waiting for offline sync.
final
cacheEnabled → bool
Globally turns the caching system ON or OFF.
final
cacheOnError → bool
Falls back to your local cache if the server crashes (5xx errors).
final
cacheOnException → bool
Falls back to your local cache if a request fails due to an exception (like a network timeout).
final
cacheOnOffline → bool
Immediately falls back to your local cache if the user makes a request while offline.
final
cacheTTL → int
How many days cached data stays in the local database before it is deleted to save space.
final
compactApiLogs → bool
Condenses all network request logs into a single clean line in your terminal.
final
computeThresholdKB → int
The threshold size (in Kilobytes) above which JSON parsing is offloaded to a background thread.
final
connCheckHost → String
The host website address (defaults to google.com) used to verify if the device has actual, active internet.
final
connDebounceMs → int
The wait time (in milliseconds) before acting on a change in your internet connection.
final
connectTimeout → Duration
How long the app should wait to establish a connection with the server before giving up.
final
connTimeout → Duration
How long to wait when doing a real-world internet check (like pinging a reliable website).
final
deduplicateByDefault → bool
Groups identical concurrent requests together by default across the entire app.
final
deduplicateEnabled → bool
Automatically groups identical network requests made at the exact same moment.
final
defaultHeaders → Map<String, String>
HTTP Headers that are automatically added to every single outgoing request.
final
disableCacheByDefault → bool
Bypasses the cache and goes directly to the internet by default for all requests.
final
disableFileLogging → bool
Disables writing log files to the physical device's storage.
final
disableLogger → bool
no setter
disableLoggerByDefault → bool
Turns off terminal logging for all requests by default.
final
enableLogging → bool
The master switch to turn the console logging system ON or OFF.
final
extraBaseUrls → Map<String, String>
Extra web addresses you can use if your app talks to multiple different servers.
final
hashCode → int
The hash code for this object.
no setterinherited
healthCheckByDefault → bool
Performs a pre-flight internet check to ensure the server is fully reachable before attempting the network call by default.
final
imageStalePeriod → int
How many days cached images are stored before they are marked stale and eligible for deletion.
final
initTimeout → Duration
How long the engine is allowed to take to set up and open its local databases (Hive) when the app starts.
final
interceptors → List<Interceptor>
Custom Dio interceptors to inject into the global LikeClient singleton.
final
maxAutoRetries → int
The maximum number of times the app will automatically retry a failed request before finally giving up.
final
maxImageCacheItems → int
The maximum number of image files allowed to be stored in the disk image cache.
final
maxImageCacheMB → double
The absolute disk storage limit (in Megabytes) allowed for caching images on the phone.
final
maxInFlightRequests → int
The maximum number of network requests allowed to run at the exact same moment.
final
maxL1CacheItems → int
The maximum number of individual responses kept in fast RAM memory at once.
final
minImageCacheMB → double
The target disk storage size (in Megabytes) the cache manager tries to clean down to when pruning old image files.
final
mockEnabled → bool
Simulates internet responses using offline mock data files.
final
offlineSyncByDefault → bool
Legacy configuration hook for mutation replay defaults.
final
offlineSyncEnabled → bool
Enables the persistent "Offline Action Sync Queue" globally.
final
perfTrackingEnabled → bool
Turns performance benchmark tracking ON or OFF globally.
final
projectName → String
The name of the project. Used as a namespace prefix for storage, cache directories, and Hive boxes.
final
rateLimitEnabled → bool
Prevents your app from spamming your API server with too many requests.
final
receiveTimeout → Duration
How long the app should wait to receive data from the server once a connection is made.
final
refreshByDefault → bool
Ignores all cache levels and forces a hard internet refresh on every request by default.
final
retryDelays → List<int>
The delay times (in seconds) between each automatic retry attempt.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout → Duration
How long the app should wait while sending data (like uploading a file or photo) to the server.
final
sensitiveHeaders → List<String>
List of headers (like password tokens or auth keys) that should be hidden/masked in logs.
final
sessionStaleByDefault → bool
Saves request results in fast RAM memory for the current session by default.
final
sessionStaleTTL → int
How many minutes session-stale RAM data is considered fresh before it expires.
final
silentApiStartLogs → bool
Hides logs that print the exact millisecond a request is initiated.
final
silentConsole → bool
Suppresses all logs in the console, even if enableLogging is true.
final
silentRefreshEnabled → bool
Keeps background revalidation silent and seamless for the user.
final
silentSyncLogs → bool
Hides background logs related to internet checks and sync actions.
final
singleFetchByDefault → bool
Restricts endpoints to be called exactly once per session by default, ignoring subsequent requests.
final
sslCertSha256 → String
The secure fingerprint string of your server's certificate used for "SSL Pinning".
final
staleWhileRevalidateByDefault → bool
Enforces Stale-While-Revalidate (SWR) behavior by default for all GET requests.
final
staleWhileRevalidateEnabled → bool
Master switch to enable the "Stale-While-Revalidate" (SWR) cache flow globally.
final
supportWeb → bool
Enabling this parameter configures the engine to operate fully safely and functionally on Web platforms without compromising key features (like caching and offline mutations).
final
suppressErrorsByDefault → bool
Prevents the app from showing automatic error popup toasts or alerts when a request fails by default.
final
throttleEnabled → bool
Blocks consecutive identical requests fired in a tiny split second.
final
toastConfig → LikeToastConfig?
Optional notification/toast callback hooks configuration.
final
unpacker → LikeDataUnpacker
A helper class that unpacks your JSON responses and extracts only the relevant data.
final
verboseLogging → bool
Enables extremely deep, detailed logs for internal developer debugging.
final
verifySSL → bool
Whether to verify SSL/TLS security certificates of the servers you connect to.
final
withAuthByDefault → bool
Attaches authorization/login headers to requests by default.
final

Methods

copyWith({String? projectName, LikeAuthConfig? authConfig, LikeToastConfig? toastConfig, String? baseUrl, LikeDataUnpacker? unpacker, Map<String, String>? extraBaseUrls, Map<String, String>? defaultHeaders, Duration? connectTimeout, Duration? receiveTimeout, Duration? sendTimeout, Duration? initTimeout, Duration? connTimeout, int? connDebounceMs, bool? enableLogging, bool? silentConsole, bool? silentSyncLogs, bool? compactApiLogs, bool? silentApiStartLogs, bool? disableFileLogging, bool? verboseLogging, List<String>? sensitiveHeaders, int? computeThresholdKB, bool? verifySSL, String? sslCertSha256, bool? cacheEnabled, bool? staleWhileRevalidateEnabled, bool? deduplicateEnabled, bool? perfTrackingEnabled, bool? rateLimitEnabled, bool? autoRetryRateLimit, bool? mockEnabled, bool? throttleEnabled, bool? silentRefreshEnabled, bool? cacheOnOffline, bool? cacheOnError, bool? cacheOnException, int? maxAutoRetries, List<int>? retryDelays, bool? automaticConnectivityChecksEnabled, Duration? automaticFailureCheckCooldown, bool? offlineSyncEnabled, bool? backgroundSyncEnabled, bool? withAuthByDefault, bool? offlineSyncByDefault, bool? disableCacheByDefault, bool? disableLoggerByDefault, bool? suppressErrorsByDefault, bool? staleWhileRevalidateByDefault, bool? sessionStaleByDefault, bool? singleFetchByDefault, bool? refreshByDefault, bool? bottomRefreshByDefault, bool? healthCheckByDefault, bool? deduplicateByDefault, int? cacheTTL, int? maxL1CacheItems, int? maxInFlightRequests, int? sessionStaleTTL, int? imageStalePeriod, int? maxImageCacheItems, double? maxImageCacheMB, double? minImageCacheMB, String? boxApiCache, String? boxOfflineQueue, String? boxCacheMetadata, String? boxEtags, String? connCheckHost, bool? supportWeb, List<Interceptor>? interceptors}) → LikeConfig
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