Flutter Firestore使用服务器时间戳批量写入

时间:2018-09-19 11:16:49

标签: android firebase dart flutter google-cloud-firestore

我刚刚将我的cloud_firestore库更新为0.8.0,现在它具有FieldValue.serverTimestamp()。当我一次将一个新条目添加到数据库时,它工作得很好。但是当我尝试批量使用它时,出现以下异常:

E/MethodChannel#plugins.flutter.io/cloud_firestore(22790): Failed to handle method call
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790): java.lang.RuntimeException: No properties to serialize found on class com.google.firebase.firestore.FieldValue$zzd
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.g.zzg$zza.<init>(com.google.firebase:firebase-firestore@@17.0.5:643)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.g.zzg.zza(com.google.firebase:firebase-firestore@@17.0.5:331)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.g.zzg.zzb(com.google.firebase:firebase-firestore@@17.0.5:152)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.g.zzg.zzb(com.google.firebase:firebase-firestore@@17.0.5:122)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.g.zzg.zza(com.google.firebase:firebase-firestore@@17.0.5:1085)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.UserDataConverter.convertPOJO(com.google.firebase:firebase-firestore@@17.0.5:437)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.google.firebase.firestore.WriteBatch.set(com.google.firebase:firebase-firestore@@17.0.5:90)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin.onMethodCall(CloudFirestorePlugin.java:416)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at android.os.MessageQueue.next(MessageQueue.java:379)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at android.os.Looper.loop(Looper.java:144)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at android.app.ActivityThread.main(ActivityThread.java:7425)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
E/MethodChannel#plugins.flutter.io/cloud_firestore(22790):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
E/flutter (22790): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter (22790): PlatformException(error, No properties to serialize found on class com.google.firebase.firestore.FieldValue$zzd, null)
E/flutter (22790): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7)
E/flutter (22790): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18)
E/flutter (22790): <asynchronous suspension>
E/flutter (22790): #2      WriteBatch.setData.<anonymous closure> (file:///C:/Users/Sello/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/cloud_firestore-0.8.0/lib/src/write_batch.dart:71:29)
E/flutter (22790): #3      _RootZone.runUnary (dart:async/zone.dart:1379:54)
E/flutter (22790): #4      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter (22790): #5      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
E/flutter (22790): #6      Future._propagateToListeners (dart:async/future_impl.dart:671:32)
E/flutter (22790): #7      Future._propagateToListeners (dart:async/future_impl.dart:569:9)
E/flutter (22790): #8      Future._complete (dart:async/future_impl.dart:476:7)
E/flutter (22790): #9      _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter (22790): #10     _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
E/flutter (22790): #11     _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:295:13)
E/flutter (22790): #12     MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart)
E/flutter (22790): <asynchronous suspension>
E/flutter (22790): #13     new WriteBatch._ (file:///C:/Users/Sello/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/cloud_firestore-0.8.0/lib/src/write_batch.dart:15:37)
E/flutter (22790): #14     Firestore.batch (file:///C:/Users/Sello/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/cloud_firestore-0.8.0/lib/src/firestore.dart:84:29)
E/flutter (22790): #15     _HomeScreenState.testTimestamp (file:///C:/Users/Sello/Documents/Android%20Projects/MoringaApp/moringa/lib/home_screen.dart:124:37)
E/flutter (22790): #16     _HomeScreenState._body.<anonymous closure> (file:///C:/Users/Sello/Documents/Android%20Projects/MoringaApp/moringa/lib/home_screen.dart:102:25)
E/flutter (22790): #17     _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
E/flutter (22790): #18     _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30)
E/flutter (22790): #19     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (22790): #20     TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter (22790): #21     TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
E/flutter (22790): #22     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (22790): #23     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (22790): #24     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (22790): #25     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter (22790): #26     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (22790): #27     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (22790): #28     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (22790): #29     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (22790): #30     _invoke1 (dart:ui/hooks.dart:142:13)
E/flutter (22790): #31     _dispatchPointerDataPacket (dart:ui/hooks.dart:99:5)

有人知道世界上正在发生什么吗?

0 个答案:

没有答案