resourceString function
Retrieves a test resource, as a String
of the file contents.
"Test resources" are files stored (by default) under the test/resources/
directory of the project root. This prefix may be changed, using the
prefix
argument.
Arguments
String path
- the relative path (from theprefix
by default).String prefix
- the path prefix from the project root (defaults totest/resources
).
Return
A String
containing the contents of the resource file.
Example
String text = resourceString('data/test.txt');
Implementation
String resourceString(String path, {String prefix = _defaultPrefix}) {
return resourceFile(path, prefix: prefix).readAsStringSync();
}