When using a file picker in my Android application, I’m encountering an issue where selecting images results in duplicates being created on the device. This happens every time I select and potentially upload images using the file picker.
Future<void> _pickFile() async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: FileType.image,
);
if (result != null) {
setState(() {
uploadedFiles = result.files;
uploadedFileNames = result.files.map((file) => file.name).toList();
});
}
}
I’m seeking guidance on how to prevent image duplication when using a file picker in my Android application
New contributor
AJUL K JOSE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.