LocationForecast.fromJson constructor

LocationForecast.fromJson(
  1. Map<String, dynamic> json
)

Deserializes a JSON-compatible map to create an instance.

Used internally, not intended for direct use by consumers. The expected map structure may change without notice.

Implementation

factory LocationForecast.fromJson(final Map<String, dynamic> json) {
  return LocationForecast(
    updated: DateTime.fromMillisecondsSinceEpoch(
      json['updated'],
      isUtc: true,
    ),
    coord: Coordinates.fromJson(json['coord']),
    forecast: (json['forecast'] as List<dynamic>)
        .map(
          (final dynamic categoryJson) => Conditions.fromJson(categoryJson),
        )
        .toList(),
  );
}