Cache<T extends CacheManager> mixin
Base class for implementing cache providers.
This class extends BaseApi class with methods that enable cache handling.
- Superclass Constraints
Properties
- cache → CacheManager
-
Get cache manager.
no setter
-
defaultHeaders
→ Map<
String, String> -
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → Uri
-
finalinherited
Methods
-
cacheAndNetwork(
Request request) → Stream< Response> -
Retrieve response from the cache if available and then from the network.
Returns
Stream<ApiResponse>
type. -
cacheIfAvailable(
Request request) → Future< Response> - Retrieve response from the cache if available or fallback to the network.
-
createCacheManager(
) → T - Creates instance of cache manager
-
delete(
String endpoint, {Map< String, String> ? headers, Map<String, dynamic> ? queryParameters, dynamic body, Encoding? encoding, DateTime? createdAt, ObjectId? id, CacheKey? key, OnProgress? onProgress}) → Future<Response> -
Send http delete request.
inherited
-
dispose(
) → void -
Disposes all links.
override
-
forEachLink(
void callback(ApiLink)) → void -
inherited
-
get(
String endpoint, {Map< String, String> ? headers, Map<String, dynamic> ? queryParameters, Encoding? encoding, DateTime? createdAt, ObjectId? id, CacheKey? key, OnProgress? onProgress}) → Future<Response> -
Send http get request.
inherited
-
getFirstLinkOfType<
T extends ApiLink?> () → T? -
Get first link of provided type from current link chain.
If ApiLink chain does not contain link of provided type,
null
will be returned.inherited -
getFirstLinkWhere(
bool test(ApiLink? link)) → ApiLink? -
inherited
-
head(
String endpoint, {Map< String, String> ? headers, Map<String, dynamic> ? queryParameters, Encoding? encoding, DateTime? createdAt, ObjectId? id, CacheKey? key, OnProgress? onProgress}) → Future<Response> -
Send http head request.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch(
String endpoint, {Map< String, String> ? headers, Map<String, dynamic> ? queryParameters, dynamic body, Encoding? encoding, DateTime? createdAt, ObjectId? id, CacheKey? key, OnProgress? onProgress}) → Future<Response> -
Send http patch request.
inherited
-
post(
String endpoint, {Map< String, String> ? headers, Map<String, dynamic> ? queryParameters, dynamic body, Encoding? encoding, DateTime? createdAt, ObjectId? id, CacheKey? key, OnProgress? onProgress}) → Future<Response> -
Send http post request.
inherited
-
put(
String endpoint, {Map< String, String> ? headers, Map<String, dynamic> ? queryParameters, dynamic body, Encoding? encoding, DateTime? createdAt, ObjectId? id, CacheKey? key, OnProgress? onProgress}) → Future<Response> -
Send http put request.
inherited
-
send(
Request request) → Future< Response> -
Make API request by triggering ApiLinks
next
methodsoverride -
shouldUpdateCache(
Request request, Response? response) → bool -
Whether
response
related torequest
should be saved to the cache. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited