resourceBytes function

Uint8List resourceBytes(
  1. String path,
  2. {String prefix = _defaultPrefix}
)

Retrieves a test resource, as a the bytes of the file content.

"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 the prefix by default).
  • String prefix - the path prefix from the project root (defaults to test/resources).

Return

A Uint8List containing the contents of the resource file.

Example

Uint8List bytes = resourceBytes('data/some.jpg');

Implementation

Uint8List resourceBytes(String path, {String prefix = _defaultPrefix}) {
  return resourceFile(path, prefix: prefix).readAsBytesSync();
}