createOrExistsFile static method

bool createOrExistsFile(
  1. String filePath
)

Implementation

static bool createOrExistsFile(String filePath) {
  final file = File(filePath);
  if (file.existsSync()) return true;
  final dirPath = path.dirname(filePath);
  if (!createOrExistsDir(dirPath)) return false;
  try {
    file.createSync();
    return true;
  } catch (_) {
    return false;
  }
}