toFile method
Future<OutputInfo>
toFile(
- Object file, {
- ImageFormat? format,
- CodecRegistry? registry,
- CancellationToken? cancellationToken,
Writes encoded output to a file path or File.
Implementation
Future<OutputInfo> toFile(
Object file, {
ImageFormat? format,
CodecRegistry? registry,
CancellationToken? cancellationToken,
}) {
final resolved = switch (file) {
final File value => value,
final String value => File(value),
_ => throw ArgumentError.value(file, 'file', 'Expected a File or path.'),
};
return writeToFile(
resolved,
format: format,
registry: registry,
cancellationToken: cancellationToken,
);
}