indexesOf method

List<int> indexesOf(
  1. num substring
)

get the index of all occurrences of substring in the number.

Implementation

List<int> indexesOf(num substring) {
  final indexes = <int>[];
  var index = 0;
  while (true) {
    index = toString().indexOf(substring.toString(), index);
    if (index == -1) break;
    indexes.add(index);
    index++;
  }
  return indexes;
}