doesFileExist function

Future<bool> doesFileExist(
  1. String? filePath
)

Implementation

Future<bool> doesFileExist(String? filePath) async {
  int fileSize = 0;
  bool fileExists = false;
  if (filePath != null) {
    var file = File(filePath);
    if (await file.exists()) {
      fileSize = await file.length();
      if (fileSize > 0) fileExists = true;
    }
  }
  return fileExists;
}