FuzzyOptions<T> constructor

FuzzyOptions<T>({
  1. int location = 0,
  2. int distance = 100,
  3. double threshold = 0.6,
  4. int maxPatternLength = 32,
  5. bool isCaseSensitive = false,
  6. Pattern? tokenSeparator,
  7. bool findAllMatches = false,
  8. int minTokenCharLength = 1,
  9. int minMatchCharLength = 1,
  10. List<WeightedKey<T>> keys = const [],
  11. bool shouldSort = true,
  12. SorterFn<T>? sortFn,
  13. bool tokenize = false,
  14. bool matchAllTokens = false,
  15. bool verbose = false,
  16. bool shouldNormalize = false,
})

Instantiate an options object. The keys list requires a positive number (they'll be normalized upon instantiation). If any weight is not positive, throws an ArgumentError.

Implementation

FuzzyOptions({
  this.location = 0,
  this.distance = 100,
  this.threshold = 0.6,
  this.maxPatternLength = 32,
  this.isCaseSensitive = false,
  Pattern? tokenSeparator,
  this.findAllMatches = false,
  this.minTokenCharLength = 1,
  this.minMatchCharLength = 1,
  List<WeightedKey<T>> keys = const [],
  this.shouldSort = true,
  SorterFn<T>? sortFn,
  this.tokenize = false,
  this.matchAllTokens = false,
  this.verbose = false,
  this.shouldNormalize = false,
})  : tokenSeparator =
          tokenSeparator ?? RegExp(r' +', caseSensitive: isCaseSensitive),
      keys = _normalizeWeights(keys),
      sortFn = sortFn ?? _defaultSortFn;