A resource that knows the version of its content: a file downloaded and kept, whose digest says which content it holds now.
A resource is equal to another by its type and its address, as in
Spring, so a result a cache made from a file that changed at the same
address would stay; with spring.cache.resource-version a cache key
made of such a resource is its address and its version, and a new
content is a new key.
- Implemented types
Properties
- description → String
-
A text that tells people which resource this is, for error messages,
such as
file [/app/config/application.properties]. It is also the default name of a property source read from it, and two resources of the same type with the same description are equal.no setterinherited - filename → String?
-
The last part of the path, such as
application.yml, ornullwhen the resource has no file name (bytes in memory).no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- isReadable → bool
-
Whether the content can be read; usually the same as exists, but
falsefor a directory.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsSyncRead → bool
-
Whether readAsBytesSync and readAsStringSync work. True for files
and the embedded classpath; false for URLs and Flutter assets.
no setterinherited
- uri → Uri?
-
The URI of the resource (
file:,https:, ...), ornullwhen it has none.no setterinherited - version → String?
-
The version of the content held now (a digest of it),
nullwhile none is held.no setter
Methods
-
createRelative(
String relativePath) → Resource -
The resource at
relativePathfrom this one, such as a sibling file next to a config file. It is not checked to exist. Throws UnsupportedError for resources without a location (bytes in memory).inherited -
exists(
) → bool -
Whether the content is there: the file exists, the classpath entry is
embedded. Check it before reading a resource that may be missing.
A
UrlResourcecannot ask the server synchronously and always saystrue.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readAsBytes(
) → Future< Uint8List> -
Reads the whole content as bytes. Works for every resource that
exists; fails for one that does not.
inherited
-
readAsBytesSync(
) → Uint8List -
Reads the whole content as bytes without waiting, for code that
cannot be asynchronous. Throws UnsupportedError unless
supportsSyncRead.
inherited
-
readAsString(
{Encoding encoding = utf8}) → Future< String> -
Reads the whole content as text, decoded with
encoding(UTF-8 unless given).inherited -
readAsStringSync(
{Encoding encoding = utf8}) → String -
Reads the whole content as text without waiting, decoded with
encoding. Throws UnsupportedError unless supportsSyncRead.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited