toString method

  1. @override
  2. @useResult
String toString()
override

Returns a ISO formatted string representation.

When possible, trailing zero seconds, milliseconds and microseconds are truncated.

final foo = LocalDateTime(2023, 5, 10, 12, 30, 1, 2, 3).toString();
print(foo); // '2023-05-10T12:30:01.002003'

final bar = LocalDateTime(2023, 5, 10, 12, 30).toString();
print(bar); // '2023-05-10T12:30'

Implementation

@override
@useResult String toString() => _string ??= '${_native.toDateString()}T${_native.toTimeString()}';