file function

FileDescriptor file(
  1. String name,
  2. [dynamic contents]

Creates a new FileDescriptor with name and contents.

The contents may be a String, a List<int>, or a Matcher. If it's a string, Descriptor.create creates a UTF-8 file and Descriptor.validate parses the physical file as UTF-8. If it's a Matcher, Descriptor.validate matches it against the physical file's contents parsed as UTF-8, and Descriptor.create is unsupported.

If contents isn't passed, Descriptor.create creates an empty file and Descriptor.validate verifies that the file is empty.

To match a Matcher against a file's binary contents, use new FileDescriptor.binaryMatcher instead.


FileDescriptor file(String name, [contents]) => FileDescriptor(name, contents);