copyWith method

Options copyWith({
  1. List<BaseMatcher>? matchers,
  2. Set<Dictionaries>? dictionaries,
  3. List<String>? userInputs,
  4. L33tTable? l33tTable,
  5. Graph? graph,
  6. bool? useLevenshteinDistance,
  7. int? levenshteinThreshold,
  8. int? l33tMaxSubstitutions,
  9. int? maxLength,
})

Creates a new instance with updated values.

Implementation

Options copyWith({
  List<BaseMatcher>? matchers,
  Set<Dictionaries>? dictionaries,
  List<String>? userInputs,
  L33tTable? l33tTable,
  Graph? graph,
  bool? useLevenshteinDistance,
  int? levenshteinThreshold,
  int? l33tMaxSubstitutions,
  int? maxLength,
}) {
  dictionaries ??= this.dictionaries;
  final Set<Dictionaries> newDictionaries = <Dictionaries>{
    ...dictionaries,
    if (userInputs != null)
      <Dictionary, List<String>>{Dictionary.userInputs: userInputs},
  };
  return Options(
    matchers: matchers ?? this.matchers,
    dictionaries: newDictionaries,
    l33tTable: l33tTable ?? this.l33tTable,
    graph: graph ?? this.graph,
    useLevenshteinDistance:
        useLevenshteinDistance ?? this.useLevenshteinDistance,
    levenshteinThreshold: levenshteinThreshold ?? this.levenshteinThreshold,
    l33tMaxSubstitutions: l33tMaxSubstitutions ?? this.l33tMaxSubstitutions,
    maxLength: maxLength ?? this.maxLength,
  );
}