rightStringAtIndex method Null safety

  1. @override
String? rightStringAtIndex(
  1. int index
)
override

Implementation

@override
String? rightStringAtIndex(int index) {
  if (index >= 0 && index < 60) {
    DateTime time = currentTime.add(Duration(days: _currentLeftIndex));
    if (isAtSameDay(minTime, time) && _currentMiddleIndex == 0) {
      if (index >= 0 && index < 60 - minTime!.minute) {
        return digits(minTime!.minute + index, 2);
      } else {
        return null;
      }
    } else if (isAtSameDay(maxTime, time) &&
        _currentMiddleIndex >= maxTime!.hour) {
      if (index >= 0 && index <= maxTime!.minute) {
        return digits(index, 2);
      } else {
        return null;
      }
    }
    return digits(index, 2);
  }

  return null;
}