title: How can I convert open weather api dt to Date using Flutter?
body: <p>I've been working on weather forecast app and now I'm trying to convert dt to simple date format, I get the following error:</p>
  <p>In forecast.dart</p>
  <pre><code>class WeatherData {
    String? placeName;
    DateTime? date;
    num? temperature;
    num? feels_like;
    num? pressure;
    num? humidity;
    num? wind_speed;
  
    WeatherData({
      this.placeName,
      this.date,
      this.temperature,
      this.feels_like,
      this.pressure,
      this.humidity,
      this.wind_speed,
    });
    @override
    String toString() =&gt;
        '${placeName ?? 'unknown'}  ${date ?? 'unknown'}  ${feels_like ?? 'unknown'}   ${temperature ?? 'unknown'}   ${pressure ?? 'unknown'} ${humidity ?? 'unknown'}  ${wind_speed ?? 'unknown'}';
  
    WeatherData.fromJson(Map&lt;String, dynamic&gt; json) {
      placeName = json['city']['name'];
      date = DateTime.fromMicrosecondsSinceEpoch(json['list'][0]['dt'] * 1000,
          isUtc: false);
      temperature = json['list'][0]['main']['temp'];
      feels_like = json['list'][0]['main']['temp'];
      pressure = json['list'][0]['main']['temp'];
      humidity = json['list'][0]['main']['temp'];
      wind_speed = json['list'][0]['main']['temp'];
    }
  }
  </code></pre>
  <p>weatherData.dart</p>
  <pre><code>import 'package:forecast/models/weather_data.dart';
  
  class ForecastData {
    final List list;
  
    ForecastData({required this.list});
  
    factory ForecastData.fromJson(Map&lt;String, dynamic&gt; json) {
      var list = json['list']?.map((e) =&gt; e)?.toList(growable: true) ?? [];
      List weatherData = [];
      list.forEach((e) {
        WeatherData w = WeatherData(
            placeName: json['city']['name'],
            date: e['dt'],
            temperature: e['main']['temp'],
            feels_like: e['main'][&quot;feels_like&quot;],
            pressure: e['main']['pressure'],
            humidity: e['main']['humidity'],
            wind_speed: e['wind']['speed']);
  
        weatherData.add(w);
        print(weatherData);
      });
  
      return ForecastData(list: weatherData);
    }
  }
  </code></pre>
  <p>output</p>
  <pre><code>Unhandled Exception: type 'int' is not a subtype of type 'DateTime?'
  </code></pre>
  <p>How can I convert dt to simple date using flutter? I'm using openweather api. any help is appreciated!</p>