fileExists function

bool fileExists(
  1. String filePath
)

Checks whether a file exists or not.

Implementation

bool fileExists(String filePath) {
  bool result = false;
  try {
    File(filePath).readAsStringSync();
    result = true;
  } catch (e) {
    printColoredString('File does not exist!', 'red');
  }
  return result;
}