NumberGroupingChecker typedef

NumberGroupingChecker = bool Function(PhoneNumberUtil util, PhoneNumber number, StringBuffer normalizedCandidate, List<String> expectedNumberGroups)

Small helper interface such that the number groups can be checked according to different criteria, both for our default way of performing formatting and for any alternate formats we may want to check.

Returns true if the groups of digits found in our candidate phone number match our expectations.

number the original number we found when parsing normalizedCandidate the candidate number, normalized to only contain ASCII digits, but with non-digits (spaces etc) retained expectedNumberGroups the groups of digits that we would expect to see if we formatted this number

Implementation

typedef NumberGroupingChecker = bool Function(
  PhoneNumberUtil util,
  PhoneNumber number,
  StringBuffer normalizedCandidate,
  List<String> expectedNumberGroups,
);