createFileIfNotExists static method

Future<bool> createFileIfNotExists(
  1. String path,
  2. String content
)

Create file with content if it doesn't exist

Implementation

static Future<bool> createFileIfNotExists(
  String path,
  String content,
) async {
  if (await fileExists(path)) {
    return false;
  }
  await writeFile(path, content);
  return true;
}