touch method

Future<bool> touch(
  1. String filePath, {
  2. dynamic sudo = false,
})

Create an empty file at filePath If sudo is true, the file will be created with sudo permissions

Implementation

Future<bool> touch(String filePath, {sudo = false}) async {
  try {
    if (Platform.isWindows) {
      await File(filePath).create();
      return true;
    } else {
      final result = await simple('touch', [filePath], sudo: sudo);
      return result.exitCode == 0;
    }
  } catch (e) {
    return false;
  }
}