splitNumber method
Implementation
@override
List<NumberSegment> splitNumber(int number) {
var separatedNumbersList = number.toString().split("");
List<NumberSegment> segments = [];
var numberString = '';
for (int i = separatedNumbersList.length - 1; i >= 0; i--) {
numberString = separatedNumbersList[i] + numberString;
if (_canAddNumberAsSegment(numberString,
noOfExistingSegments: segments.length, indexOfNumber: i)) {
var segment = _getSegmentForNumber(numberString,
noOfExistingSegments: segments.length);
segments.insert(0, segment);
numberString = '';
}
}
return segments.toList();
}