copyFile method
Implementation
Future<File> copyFile(String tempPath, String lastPath) async {
var fileName = tempPath.split("/").last;
var frontPath = (await getApplicationDocumentsDirectory()).path;
var file = File(tempPath);
var newPath = "$frontPath/$lastPath";
var isAvailable = await Directory(newPath).exists();
if (!isAvailable) await Directory(newPath).create(recursive: true);
File newFile = await file.copy("$newPath/$fileName");
return newFile;
}