deleteFile function

Future<bool> deleteFile(
  1. String path,
  2. String filename
)

Delete file

Implementation

Future<bool> deleteFile(String path, String filename) async {
  bool fileExists = await ckFileExists(path, filename);

  /// Return [true] if file does not exists, treade it as deleted
  if (!fileExists) return true;

  /// Try to delete file
  try {
    File file = _getFile(path, filename);
    await file.delete();
  } catch (e) {
    throw ('Unable to delete file');
  }

  return true;
}