getFileFromPath static method

Future<File> getFileFromPath(
  1. String filePath
)

Implementation

static Future<File> getFileFromPath(String filePath) async {
  AppConfig.logger.d("Getting File From Path: $filePath");
  File file = File("");

  try {
    AppConfig.logger.i("File Path: $filePath");

    if(Platform.isAndroid) {
      file = File(filePath);
    } else {
      file = await File.fromUri(Uri.parse(filePath)).create();
    }
  } catch (e) {
    AppConfig.logger.e('Error getting File');
  }

  return file;
}