LikeConfig class

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

Constructors

LikeConfig({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, String? encryptionKey, 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 offlineSyncEnabled = true, bool backgroundSyncEnabled = true, bool withAuthByDefault = true, bool offlineSyncByDefault = true, bool disableCacheByDefault = false, bool disableLoggerByDefault = false, bool suppressErrorsByDefault = true, bool staleWhileRevalidateByDefault = true, 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 = 'like_api_cache', String boxOfflineQueue = 'like_offline_queue', String boxCacheMetadata = 'like_cache_metadata', String boxEtags = 'like_etags', String connCheckHost = 'google.com'})

Properties

autoRetryRateLimit bool
Automatically retries requests that fail due to rate limiting (429).
final
backgroundSyncEnabled bool
Enables background synchronization tasks while the app is in the background.
final
baseUrl String
The primary base URL for all network requests.
final
bottomRefreshByDefault bool
Whether to trigger a "bottom" loading indicator for pagination by default.
final
boxApiCache String
Name of the Hive box for API response caching.
final
boxCacheMetadata String
Name of the Hive box for cache metadata and timestamps.
final
boxEtags String
Name of the Hive box for storing ETag values.
final
boxOfflineQueue String
Name of the Hive box for the offline synchronization queue.
final
cacheEnabled bool
Enables the L2 (Disk) and L3 (SWR) caching systems globally.
final
cacheOnError bool
If true, returns cached data when a server error (5xx) occurs.
final
cacheOnException bool
If true, returns cached data when a network exception (timeout, etc.) occurs.
final
cacheOnOffline bool
If true, attempts to return cached data when the device is offline.
final
cacheTTL int
Time-To-Live in days for data stored in the L2 (Disk) cache.
final
compactApiLogs bool
If true, simplifies API logs to a single line per request.
final
computeThresholdKB int
Threshold in KB above which JSON parsing will be offloaded to a background isolate.
final
connCheckHost String
Host used to check internet reachability (defaults to google.com).
final
connDebounceMs int
Debounce time in milliseconds for connectivity status changes to prevent flickering.
final
connectTimeout Duration
Maximum time to wait for a connection to be established.
final
connTimeout Duration
Timeout for connectivity reachability checks (e.g., pinging google.com).
final
deduplicateByDefault bool
Whether to deduplicate identical concurrent requests by default.
final
deduplicateEnabled bool
Enables request deduplication to prevent redundant concurrent calls.
final
defaultHeaders Map<String, String>
Default HTTP headers to be included in every request.
final
disableCacheByDefault bool
Whether to bypass the cache by default.
final
disableFileLogging bool
If true, disables writing logs to a local file for debugging.
final
disableLogger bool
no setter
disableLoggerByDefault bool
Whether to suppress logging for specific requests by default.
final
enableLogging bool
Globally enables or disables the LIKE logging system.
final
encryptionKey String?
Optional AES key for encrypting cached data on disk.
final
extraBaseUrls Map<String, String>
A map of alternative base URLs for multi-tenant or multi-service environments.
final
hashCode int
The hash code for this object.
no setterinherited
healthCheckByDefault bool
Whether to perform a server health check before executing the request.
final
imageStalePeriod int
Time in days after which cached images are considered stale.
final
initTimeout Duration
Timeout for the engine's initial setup and box opening.
final
maxAutoRetries int
Maximum number of automatic retries for failed requests.
final
maxImageCacheItems int
Maximum number of images allowed in the persistent image cache.
final
maxImageCacheMB double
Maximum size in MB for the image cache on disk.
final
maxInFlightRequests int
Maximum number of concurrent network requests allowed.
final
maxL1CacheItems int
Maximum number of items to keep in the L1 (RAM) cache.
final
minImageCacheMB double
Target size in MB to reach when cleaning up the image cache.
final
mockEnabled bool
If true, the engine will intercept requests and return mock data if available.
final
offlineSyncByDefault bool
Whether to queue mutation requests for offline sync by default.
final
offlineSyncEnabled bool
Enables the offline queue for persisting mutation requests (POST/PUT/DELETE).
final
perfTrackingEnabled bool
Enables performance tracking for network requests and JSON parsing.
final
rateLimitEnabled bool
Enables internal rate limiting to prevent API abuse.
final
receiveTimeout Duration
Maximum time to wait for receiving a chunk of data from the server.
final
refreshByDefault bool
Whether to force a network refresh and bypass cache by default.
final
retryDelays List<int>
List of delays in seconds between consecutive retries (e.g., 1, 2, 4).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout Duration
Maximum time to wait for sending data to the server.
final
sensitiveHeaders List<String>
List of HTTP headers that should be masked in logs for security (e.g., Authorization).
final
sessionStaleByDefault bool
Whether to use a short-lived "session cache" for this request by default.
final
sessionStaleTTL int
Time in minutes for which session-stale data is considered valid.
final
silentApiStartLogs bool
If true, hides logs indicating the start of an API request.
final
silentConsole bool
If true, prevents logs from being printed to the system console.
final
silentRefreshEnabled bool
Enables background refreshing of state without triggering UI loading indicators.
final
silentSyncLogs bool
If true, prevents logs related to background synchronization tasks.
final
singleFetchByDefault bool
If true, ensures only one instance of this request type is active across the app.
final
sslCertSha256 String
Optional SHA256 fingerprint for SSL pinning.
final
staleWhileRevalidateByDefault bool
Whether to enable SWR revalidation by default.
final
staleWhileRevalidateEnabled bool
Enables the Stale-While-Revalidate (SWR) background refresh logic.
final
suppressErrorsByDefault bool
Whether to suppress global error UI/toasts for failed requests by default.
final
throttleEnabled bool
Enables request throttling to limit the frequency of identical calls.
final
unpacker LikeDataUnpacker
An unpacker strategy used to extract domain data from standard API envelopes.
final
verboseLogging bool
Enables extremely detailed logs for internal engine cycles.
final
verifySSL bool
Whether to verify SSL certificates. Usually false in debug/development.
final
withAuthByDefault bool
Whether to include authentication headers by default.
final

Methods

copyWith({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, String? encryptionKey, 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? 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}) 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