writeAsBytes method
Writes bytes
to a binary file located at id
.
Returns a Future that completes after writing the asset out.
- Throws an error if the output was not valid (that is, the resulting file extension is not in allowedExtensions)
NOTE: Most Builder
implementations should not need to await
this
Future since the runner will be responsible for waiting until all outputs
are written.
@param bytes The binary content to write @param extension The extension of the file to be written (must be in allowedExtensions)
Implementation
@override
Future<void> writeAsBytes(
List<int> bytes, {
required String extension,
}) async {
assert(
outputUri == asset.uriWithExtension(extension),
'Unexpected output uri, expected $outputUri',
);
_buffer.writeln(utf8.decode(bytes));
}