readDateTimeJsonObject function

DateTime readDateTimeJsonObject(
  1. Map<String, dynamic> json
)

Reads a date/time JSON object, found in the station list for example.

Implementation

DateTime readDateTimeJsonObject(Map<String, dynamic> json) {
  final time = json['time'];
  if (time is! int) {
    throw FormatException(
      'Unexpected time format in date/time JSON object!',
      time,
    );
  }
  return DateTime.fromMillisecondsSinceEpoch(time);
}