title: Flutter issue: type 'Timestamp' is not a subtype of type 'DateTime'
body: <p>I'm looking for some help for an app my team and I are working on. We are facing the following problem for weeks : </p>
  
  <pre><code>flutter type 'Timestamp' is not a subtype of type 'DateTime'
  </code></pre>
  
  <p>We want to get these user data from <strong>Cloud Firestore</strong>:</p>
  
  <ul>
  <li>birth [DateTime]</li>
  <li>gender [String]</li>
  <li>license [DateTime]</li>
  <li>name [String]</li>
  <li>size [String]</li>
  <li>weight [String]</li>
  </ul>
  
  <p>Only <strong>birth</strong> and <strong>license</strong> are stored as [Timestamp] in Cloud Firestore so we parse these data to [DateTime].</p>
  
  <p>Here's our code to get user's data :</p>
  
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  
  class User{
    final String _name;
    final String _gender; // 'homme' or 'femme' or 'autre'
    final DateTime _birth;
    final DateTime _license;
    final double _weight;
    final int _size;
    DocumentReference ref;
  
    User(this._birth,this._gender,this._license,this._name,this._size,this._weight,this.ref);
  
    User.fromMap(Map&lt;String, dynamic&gt; map, {this.ref})
        : assert(map['name'] != null &amp;&amp; map['gender'] != null &amp;&amp; map['birth'] != null &amp;&amp; map['weight'] != null &amp;&amp; map['size'] != null),
          _name = map['name'],
          _gender = map['gender'],
          _birth = map['birth'] as DateTime,
          _license = map['license'] as DateTime,
          _weight = double.parse(map['weight']),
          _size = int.parse(map['size']);
  
    User.fromSnapshot(DocumentSnapshot snapshot)
        : this.fromMap(snapshot.data, ref: snapshot.reference);
  
    String get name =&gt; _name;
    String get gender =&gt; _gender;
    DateTime get birth =&gt; _birth;
    DateTime get license =&gt; _license;
    double get weight =&gt; _weight;
    int get size =&gt; _size;
  }
  </code></pre>
  
  <p>And here's where we call these functions and where the issue seems to appear :</p>
  
  <pre><code>import 'package:bappsalcolit/pages/homepage.dart';
  import 'package:flutter/material.dart';
  import 'package:bappsalcolit/sign_in/auth.dart';
  import 'package:bappsalcolit/sign_in/log_page.dart';
  import 'package:bappsalcolit/ads_display.dart';
  import 'package:bappsalcolit/dbase/model/global_info.dart';
  
  import 'package:cloud_firestore/cloud_firestore.dart';
  
  User currentUser = User(null, null, null, null, null, null, null);
  
  class RootPage extends StatefulWidget {
    RootPage({this.auth});
  
    final AuthImpl auth;
  
    @override
    State&lt;StatefulWidget&gt; createState() =&gt; new _RootPageState();
  }
  
  enum AuthStatus {
    NOT_DETERMINED,
    NOT_SIGNED_IN,
    SIGNED_IN,
  }
  
  class _RootPageState extends State&lt;RootPage&gt; {
    AuthStatus authStatus = AuthStatus.NOT_DETERMINED;
    String _userID = "";
  
    @override
    void initState(){
      super.initState();
      Ads.hideBanner();
      widget.auth.getCurrentUser().then((user) {
        setState(() {
          if(user != null) {
            _userID = user?.uid;
          }
          authStatus =
          user?.uid == null ? AuthStatus.NOT_SIGNED_IN : AuthStatus.SIGNED_IN;
        });
      });
    }
  
    void _signedIn() {
      widget.auth.getCurrentUser().then((user){
        setState(() {
          _userID = user?.uid.toString();
        });
      });
      setState(() {
        authStatus = AuthStatus.SIGNED_IN;
      });
    }
  
    void _signedOut() {
      setState(() {
        authStatus = AuthStatus.NOT_SIGNED_IN;
        _userID = "";
      });
    }
  
    Widget _buildWaitingScreen() {
      return Scaffold(
        body: Container(
          height: 20.0,
          width: 20.0,
          alignment: Alignment.center,
          child: CircularProgressIndicator(),
        ),
      );
    }
  
    //========== Here's where the problem seems to appear ==========\\
    gettingSnapshots(){
      Firestore db = Firestore.instance;
      DocumentSnapshot userDS;
      db.collection('users').document(_userID).snapshots().listen((ds) async{
        if (ds.exists) {
          userDS = await db.collection('users').document(_userID).get();
          try {
            currentUser = User.fromSnapshot(userDS);
          } catch (e) {
            print('Error 1131: $e');
          }
        }
      });
    }
  
    @override
    Widget build(BuildContext context) {
      switch (authStatus) {
        case AuthStatus.NOT_SIGNED_IN:
          return new SignIn(
            auth: widget.auth,
            onSignedIn: _signedIn,
          );
          break;
        case AuthStatus.SIGNED_IN:
          if(_userID.length &gt; 0 &amp;&amp; _userID != null) {
            gettingSnapshots();
            return new HomePage(
              userID: _userID,
              auth: widget.auth,
              onSignedOut: _signedOut,
            );
          }
          break;
        case AuthStatus.NOT_DETERMINED:
          return _buildWaitingScreen();
          break;
      }
      return _buildWaitingScreen();
    }
  }
  </code></pre>
  
  <p>The issue only occurs on iOS. Everything is OK on Android.</p>
  
  <p>The problem should not come from the link between Cloud Firestore and the app because we can get other stored information.</p>