loadFromFile static method

Future<GitignoreParser> loadFromFile(
  1. String path
)

Loads and parses a .gitignore file at path.

Returns an empty parser if the file does not exist.

Implementation

static Future<GitignoreParser> loadFromFile(String path) async {
  final file = File(path);
  if (!await file.exists()) return GitignoreParser._([]);
  final content = await file.readAsString();
  return GitignoreParser.parse(content);
}