In-memory implementation of AssetReader and AssetWriter.
testing provides a ReaderWriterTesting that gives access to the in-memory filesystem for tests to directly modify files and check on files.
Writes and deletes are notified to FakeWatcher.
You must pass a rootPackage if the TestReaderWriter will be used in
a build. This specifies which package build_runner is running in.
On disk "hidden" assets are placed under .dart_tool/build/generated/<package>
while non-hidden assets are placed in the main source tree.
Some parts of this API are from the point of view of a builder and use a
unified namespace for AssetIds, while others see a split view
of the hidden/non-hidden filesystem structure, and require an explicit
mapping of AssetIds to the on-disk structure
(eg. starting with .dart_tool/build/generated/) to access hidden files.
See testBuilders flattenOutput parameter for more details.
Constructors
- TestReaderWriter({String? rootPackage})
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- testing → ReaderWriterTesting
-
no setter
Methods
-
canRead(
AssetId id) → Future< bool> -
inherited
-
digest(
AssetId id) → Future< Digest> -
Returns a
Digestrepresenting a hash of the contents ofid.inherited -
findAssets(
Glob glob) → Stream< AssetId> -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readAsBytes(
AssetId id) → Future< List< int> > -
inherited
-
readAsString(
AssetId id, {Encoding encoding = utf8}) → Future< String> -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
writeAsBytes(
AssetId id, List< int> bytes) → Future<void> -
inherited
-
writeAsString(
AssetId id, String contents, {Encoding encoding = utf8}) → Future< void> -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited