Flutter app error - type 'Timestamp' is not a subtype of type 'DateTime'

后端 未结 14 1367
刺人心
刺人心 2020-12-16 12:49

I\'m fetching data cloud firestore & trying to show in my app by using the following piece of code.

new Text(timeago.format(document.data[\'tripDoc\'][\'         


        
14条回答
  •  既然无缘
    2020-12-16 13:08

    Try document.data["data"].microsecondsSinceEpoch

    This is working for me:-

    User.fromDocument(DocumentSnapshot document){
    dataNasc = DateTime.fromMicrosecondsSinceEpoch(document.data["data"].microsecondsSinceEpoch);
    }
    

提交回复
热议问题