toString method

  1. @override
String toString()
override

Returns a human-readable string for this instance.

The returned string is constructed for the time zone of this instance. The toString() method provides a simply formatted string.

The resulting string can be parsed back using parse.

Implementation

@override
String toString() {
  final y = _fourDigits(year);
  final m = _twoDigits(month);
  final d = _twoDigits(day);
  final h = _twoDigits(hour);
  final min = _twoDigits(minute);
  final sec = _twoDigits(second);
  final ms = _threeDigits(millisecond);
  final us = microsecond == 0 ? '' : _threeDigits(microsecond);
  return '$y-$m-$d $h:$min:$sec.$ms$us';
}