toDate method
Converts this timestamp to a DateTime in the local time zone, with microsecond precision. Sub-microsecond precision is truncated toward the earlier time.
Call toUtc() on the result for a UTC DateTime. When compiled to
JavaScript, the microseconds are lost as well.
Implementation
DateTime toDate() {
// Milliseconds first, then the remaining microseconds: seconds * 10^6 is
// above 2^53 (not exact on the web) for dates after about the year 2255.
return DateTime.fromMillisecondsSinceEpoch(
seconds * 1000 + nanoseconds ~/ 1000000,
).add(Duration(microseconds: (nanoseconds ~/ 1000) % 1000));
}