Ignore class

A set of ignore rules representing a single ignore file.

An Ignore instance holds .gitignore rules relative to a given path.

Example:

import 'package:ignore/ignore.dart';

void main() {
  final ignore = Ignore([
    '*.o',
  ]);

  print(ignore.ignores('main.o')); // true
  print(ignore.ignores('main.c')); // false
}
Annotations
  • @sealed

Constructors

Ignore.new(List<String> patterns, {bool ignoreCase = false, void onInvalidPattern(String pattern, FormatException exception)?})
Create an Ignore instance with a set of .gitignore compatible patterns.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

ignores(String path) bool
Returns true if path is ignored by the patterns used to create this Ignore instance, assuming those patterns are placed at ..
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

listFiles({String beneath = '', required Iterable<String> listDir(String), required Ignore? ignoreForDir(String), required bool isDir(String), bool includeDirs = false}) List<String>
Returns all the files in the tree under (and including) beneath not ignored by ignore-files from root and down.