【问题标题】:Firestore: Some values from my flutter app are not uploaded to Firestore databaseFirestore:我的颤振应用程序中的某些值未上传到 Firestore 数据库
【发布时间】:2019-06-26 16:02:57
【问题描述】:

在我的 Flutter 应用程序中,用户应该输入个人数据,然后将其发送到我的 Firestore 数据库。问题是apparently 一些数据没有上传,shows null 在数据库网页上。这很有趣,因为some other data of the same type is getting uploaded despite the problemNo memory leaks 被我找到了。在将它们发送到数据库之前,通过打印出这些值来检查它。

class AdditionalInfo {

  final GeoPoint coordinates;  
  final String addressName;
  final String timeAndDaysBegin;
  final String timeAndDaysEnd;
  final String daysOfTheWeek;

  AdditionalInfo({
    @required this.coordinates,
    @required this.addressName,
    @required this.timeAndDaysBegin,
    @required this.timeAndDaysEnd,
    @required this.daysOfTheWeek,
  });

 Map<String, dynamic> toJson() =>
  {
    'coor': coordinates,
    'adrsNm':addressName,
    'tmNdDsBgn' : timeAndDaysBegin,
    'tmNdDsNd': timeAndDaysEnd,
    'dsFThWk':daysOfTheWeek,
  };
}

然后我创建具有 AdditionalInfo 类的对象并将其上传到 Firestore - 就这么简单,但有些数据会丢失。

【问题讨论】:

  • 你能告诉我们你做了什么吗?
  • 对不起,我的代码一团糟,你可能会在试图理解它时失去重点。我想说的是 90% 的数据正在上传,我确信其余 10% 的数据正在以相同的正确方式上传,但由于奇怪的原因它没有显示在那里,所以我'我问的更像是以前是否有人遇到过这个问题,或者这是不可能的,我在某个地方犯了错误。但是感谢@GaboBrandX
  • 没有代码很难帮你。这可能有很多原因,您处理期货或流的方式等。
  • @GaboBrandX,你可以在这里查看我的一小部分代码
  • @GaboBrandX 啊哈哈,对不起,老兄,那是因为我的函数在我的一个小部件的状态类中。

标签: firebase flutter google-cloud-firestore


【解决方案1】:

问题出在我的页面父小部件的状态类内部创建的函数,结果证明它必须在外部

【讨论】:

    猜你喜欢
    • 2020-10-20
    • 1970-01-01
    • 2021-04-18
    • 1970-01-01
    • 2021-05-05
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2018-11-18
    相关资源
    最近更新 更多