validateSaveAsInput method
void
validateSaveAsInput({})
Throws InvalidInputException for input that saveAs (or, with a
null input, openWriteAs) rejects. FileSaver.saveAs and
FileSaver.openWriteAs call it before the directory picker opens, so
that the user isn't asked for a directory the save then can't use.
Implementation
void validateSaveAsInput({
SaveInput? input,
required String fileName,
required FileType fileType,
}) {
switch (input) {
case SaveBytesInput(:final fileBytes):
validateBytesInput(fileBytes, fileName);
case SaveFileInput(:final filePath):
validateFilePathInput(filePath, fileName);
case SaveNetworkInput(:final url):
validateNetworkInput(url, fileName);
case null:
if (fileName.isEmpty) {
throw const InvalidInputException('File name cannot be empty');
}
}
}