timestampToDate static method

DateTime? timestampToDate(
  1. dynamic json
)

Returns a DateTime from a JSON-encoded int (UTC seconds since epoch)

Implementation

static DateTime? timestampToDate(dynamic json) {
  if (json == null) {
    return null;
  }
  final int timestamp = JsonObject.parseInt(json)!;
  return DateTime.fromMillisecondsSinceEpoch(
      Duration.millisecondsPerSecond * timestamp,
      isUtc: true);
}