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
FutureOr<void> writeAsBytes(
List<int> bytes, {
required String extension,
}) async {
final Uri outputUri = _getOutputUri(extension);
await File.fromUri(outputUri).writeAsBytes(bytes);
_outputs.add(outputUri);
}