Unhandled Exception: FileSystemException: Cannot retrieve length of file

Viewed 315

When I try to rename a File it throws a FileSystemException Exception this is the exception:

E/flutter (12252): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FileSystemException: Cannot retrieve length of file, path = '' (OS Error: No such file or directory, errno = 2)

this is the code:

                      for (String path in _files.paths)
                      {
                        for (File file in _pickedFiles)
                        {
                          if(file.path == path)
                          {
                            await _pickedFiles.last.rename(_path.withoutExtension(file.path) + '()' + _path.extension(file.path));
                          }
                        }
                      }

Please help me Thank you.

0 Answers
Related