1 year ago

#374531

test-img

ali

Rename image that has been picked by imagepicker for flutter

I would like to rename the file that i already pick from my gallery by image picker, i already try the below method using renameAsync

String dir = path.dirname(pickedFile.path);
String newName = path.join(dir, 'customname.jpg');
File(pickedFile.path).renameSync(newName);

however it return error [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: FileSystemException: Cannot rename file to ....

flutter

dart

imagepicker

0 Answers

Your Answer

Accepted video resources