match method

  1. @override
List<FutureOr<List<BaseMatch>>> match(
  1. String password
)
override

Should return the matches for the password.

A synchronous matcher should return a list (usually of length 1) of lists of matches. An asynchronous matcher can return a list of futures that completes with a list of matches.

Implementation

@override
List<FutureOr<List<BaseMatch>>> match(String password) {
  final List<BaseMatch> matches = <BaseMatch>[];
  final List<Future<List<BaseMatch>>> futures = <Future<List<BaseMatch>>>[];
  final List<BaseMatcher> matchers = <BaseMatcher>[
    ...this.matchers,
    ...options.matchers,
  ];
  for (final BaseMatcher matcher in matchers) {
    final List<FutureOr<List<BaseMatch>>> result = matcher.match(password);
    matches.addAll(synchronousMatches(result));
    futures.addAll(asynchronousMatches(result));
  }
  return <FutureOr<List<BaseMatch>>>[matches, ...futures];
}