ResourceProviderMixin mixin
A mixin for test classes that adds a memory-backed ResourceProvider and
utility methods for manipulating the file system.
The resource provider will use paths in the same style as the current
platform unless the TEST_ANALYZER_WINDOWS_PATHS environment variable is
set to true, in which case it will use Windows-style paths.
The utility methods all take a posix style path and convert it as appropriate for the actual platform.
- Mixin applications
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- pathContext → Context
-
The path context of resourceProvider.
no setter
- resourceProvider → ResourceProvider
-
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
convertPath(
String filePath) → String -
Converts the given posix
filePathto conform to resourceProvider's path context. -
deleteFile(
String path) → void -
Deletes the file at
path. -
deleteFolder(
String path) → void -
Deletes the folder at
path. -
fromUri(
Uri uri) → String -
Returns
urias a String. -
getFile(
String path) → File -
Gets the
Fileatpath. -
getFolder(
String path) → Folder -
Gets the
Folderatpath. -
join(
String part1, [String? part2, String? part3, String? part4, String? part5, String? part6, String? part7, String? part8]) → String -
Joins the part paths as per
path.Context.join. -
modifyFile2(
File file, String content) → void -
Writes
contenttofile. -
newAnalysisOptionsYamlFile(
String directoryPath, String content) → File -
Writes a new
analysis_options.yamlfile atdirectoryPathwithcontent. -
newBazelBuildFile(
String directoryPath, String content) → File -
Creates a new Bazel BUILD file at
directoryPathwithcontent. -
newBuildGnFile(
String directoryPath, String content) → File -
Creates a new BUILD.gn file at
directoryPathwithcontent. -
newFile(
String path, String content) → File -
Writes
contentto the file atpath. -
newFolder(
String path) → Folder -
Creates and returns a new
Folderatpath. -
newLink(
String path, String target) → Link -
Creates and returns a new
Linkatpathtotarget. -
newPackageConfigJsonFile(
String directoryPath, String content) → File -
Writes a
.dart_tool/package_config.jsonfile atdirectoryPathwithcontent. -
newPackageConfigJsonFileFromBuilder(
String directoryPath, PackageConfigFileBuilder builder) → File -
Writes a
.dart_tool/package_config.jsonfile atdirectoryPath. -
newPubspecYamlFile(
String directoryPath, String content) → File -
Writes a
pubspec.yamlfile atdirectoryPathwithcontent. -
newSinglePackageConfigJsonFile(
{required String packagePath, required String name}) → void -
Writes a new
.dart_tool/package_config.jsonfile for a package rooted atpackagePath, namedname. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toUri(
String path) → Uri -
Converts
pathto a URI. -
toUriStr(
String path) → String -
Converts
pathto a URI and returns the normalized String representation of the URI.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited