twoDigits property

String get twoDigits

2位补0

Implementation

String get twoDigits {
  int absN = this.abs();
  String sign = this < 0 ? "-" : "";
  if (absN >= 10) return "$this";
  return "${sign}0$absN";
}