createIgnoreFile method

void createIgnoreFile({
  1. dynamic onAlreadyExists()? = onIgnoreFileAlreadyExists,
  2. dynamic onSuccessfullyCreated()? = onIgnoreFileSuccessfullyCreated,
  3. dynamic onRepositoryNotInitialized()? = onRepositoryNotInitialized,
})

Creates an ignoreFile

Implementation

void createIgnoreFile({
  Function()? onAlreadyExists = onIgnoreFileAlreadyExists,
  Function()? onSuccessfullyCreated = onIgnoreFileSuccessfullyCreated,
  Function()? onRepositoryNotInitialized = onRepositoryNotInitialized,
}) {
  if (!repository.isInitialized) {
    debugPrintToConsole(
      message: "Repository not initialized",
    );
    onRepositoryNotInitialized?.call();
    return;
  }

  if (ignoreFile.existsSync()) {
    onAlreadyExists?.call();
    return;
  }

  ignoreFile.createSync(recursive: true, exclusive: true);
  onSuccessfullyCreated?.call();
}