expandRange method

List<PhoneNumber> expandRange()

Returns a list of PhoneNumbers in the range this to endOfRange inclusive.

Implementation

List<PhoneNumber> expandRange() {
  var first = BigInt.parse(start.international);
  var last = BigInt.parse(end.international);

  var range = <PhoneNumber>[];
  for (var current = first; current <= last; current = current + BigInt.one) {
    final next = PhoneNumber(
      isoCode: start.isoCode,
      nsn: current.toString().substring(countryCode.length),
    );
    range.add(next);
  }

  return range;
}