我正在为我和我的团队正在开发的应用程序寻求帮助。我们面临以下问题数周:
flutter type 'Timestamp' is not a subtype of type 'DateTime'
Run Code Online (Sandbox Code Playgroud)
我们想从Cloud Firestore获取这些用户数据:
Cloud Firestore 中仅将出生和执照作为 [Timestamp] 存储,因此我们将这些数据解析为 [DateTime]。
这是我们获取用户数据的代码:
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<String, dynamic> map, {this.ref})
: assert(map['name'] != null && map['gender'] != …Run Code Online (Sandbox Code Playgroud)