DateTime.fromJson constructor

DateTime.fromJson(
  1. Object? j
)

Implementation

factory DateTime.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return DateTime(
    year: switch (json['year']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    month: switch (json['month']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    day: switch (json['day']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    hours: switch (json['hours']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    minutes: switch (json['minutes']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    seconds: switch (json['seconds']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    nanos: switch (json['nanos']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    utcOffset: switch (json['utcOffset']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    timeZone: switch (json['timeZone']) {
      null => null,
      Object $1 => TimeZone.fromJson($1),
    },
  );
}