copyTo method
Copies the file to a new location.
Implementation
Future<String> copyTo(String path) async {
if (_tempFilePath != null) {
final tempFile = File(_tempFilePath);
if (await tempFile.exists()) {
await tempFile.copy(path);
return path;
}
}
final file = File(path);
await file.writeAsBytes(data);
return file.path;
}