call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
FileType type = FileType.any;
var typeParsed = namedArguments[const Symbol('type')];
if (typeParsed != null) {
type = typeParsed as FileType;
}
bool withData = false;
var withDataParsed = namedArguments[const Symbol('withData')];
if (withDataParsed != null) {
withData = withDataParsed as bool;
}
bool allowMultiple = false;
var allowMultipleParsed = namedArguments[const Symbol('allowMultiple')];
if (allowMultipleParsed != null) {
allowMultiple = allowMultipleParsed as bool;
}
String? dialogTitle;
var dialogTitleParsed = namedArguments[const Symbol('dialogTitle')];
if (dialogTitleParsed != null) {
dialogTitle = dialogTitleParsed as String;
}
List<String>? allowedExtensions;
var allowedExtensionsParsed =
namedArguments[const Symbol('allowedExtensions')];
if (allowedExtensionsParsed != null) {
allowedExtensions = (allowedExtensionsParsed as List).cast<String>();
}
bool allowCompression = true;
var allowCompressionParsed =
namedArguments[const Symbol('allowCompression')];
if (allowCompressionParsed != null) {
allowCompression = allowCompressionParsed as bool;
}
int compressionQuality = 30;
var compressionQualityParsed =
namedArguments[const Symbol('compressionQuality')];
if (compressionQualityParsed != null) {
compressionQuality = compressionQualityParsed as int;
}
return picker
.pickFiles(
allowCompression: allowCompression,
compressionQuality: compressionQuality,
allowedExtensions: allowedExtensions,
allowMultiple: allowMultiple,
dialogTitle: dialogTitle,
withData: withData,
type: type)
.then(
(value) {
return value != null ? FilePickerResultIns(value) : null;
},
);
}