getAllIpAddressesInRange method

List<String> getAllIpAddressesInRange()

Implementation

List<String> getAllIpAddressesInRange() {
  List<String> ipAddresses = List<String>.empty(growable: true);

  //start with lowest address
  int currentAddress = octetsToInteger(this.calculateNetworkAddress());
  //increment address using int value
  while (currentAddress < octetsToInteger(this.calculateLastIpAddress())) {
    currentAddress++;
    ipAddresses.add(octetsToString(integerToOctets(currentAddress)));
  }
  // generate the string representation and store it in list
  return ipAddresses;
}