WarmCacheRequest class
Describes a single endpoint to pre-populate during cache warming.
Pass a list of these to NetworkService.warmCache to prime the cache at app startup so data is available instantly on first render.
await NetworkService.warmCache([
WarmCacheRequest(endPoint: '/dashboard', method: ApiMethods.get),
WarmCacheRequest(
endPoint: '/products',
method: ApiMethods.get,
queryParams: {'limit': 20},
cacheDuration: Duration(hours: 6),
),
]);
Constructors
-
WarmCacheRequest({required String endPoint, required ApiMethods method, Map<
String, dynamic> ? queryParams, dynamic body, Duration cacheDuration = const Duration(days: 3)}) -
const
Properties
- body → dynamic
-
Optional request body (for POST/PUT warming).
final
- cacheDuration → Duration
-
How long the pre-warmed data is considered fresh. Defaults to 3 days.
final
- endPoint → String
-
Endpoint path appended to the configured base URL.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- method → ApiMethods
-
HTTP method for this prefetch call.
final
-
queryParams
→ Map<
String, dynamic> ? -
Optional query parameters.
final
- 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