CachedWebRequest class
Core class for creating a new web request using the package cache system.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
HTTP headers which get sent with the request.
final
-
responseFunction
↔ Future<
Response> Function(Uri uri, {Map<String, String> ? headers}) -
The function used to send the request.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → String
-
The URL which is used to send the request.
final
- webCacheType → AbstractWebCacheType
-
The used cache type.
final
Methods
-
buildResponseFromDocument(
WebCacheDocument document) → Response -
deleteCacheDocument(
) → Future< void> - Deletes the cache file for the request.
-
getCacheFile(
) → Future< File> - Returns the File in which this CachedWebRequest will be saved.
-
getFileName(
) → String - The name which will be used for generating a WebCacheDocument file.
-
hasCachedDocument(
) → Future< bool> - Whether this CachedWebRequest already has a cached WebCacheDocument or not.
-
isValidResponse(
Response response) → bool - Function used to validate whether a given response is valid for being saved in a WebCacheDocument.
-
loadCachedDocument(
) → Future< WebCacheDocument> - Loads the corresponding WebCacheDocument for the given request url.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
saveNewCacheResponse(
Response response) → Future< void> -
Saves the given
response
into the corresponding persistent WebCacheDocument. -
serializeResponseBody(
Response response) → String - Function used to get the serialized form of a valid response.
-
startRequest(
{bool forceNewRequest = false}) → Future< Response> - Performs the request.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
clearCache(
) → Future< void> - Clears the cache by deleting the entire cache directory.
-
getSaveFolder(
) → Future< Directory> - Get the Directory where cache files will be saved.
Constants
- subfolderName → const String
- The subfolder name used for the folder where cache files get stored.