Checks whether a file exists.
bool fileExists(String filePath) { bool result = false; try { File(filePath).readAsStringSync(); result = true; } catch (e) { result = false; } return result; }