I got some problem about querySnapshot

2,753 views
Skip to first unread message

Pound Pvd

unread,
Sep 18, 2018, 11:17:04 PM9/18/18
to Flutter Dev
this my error message 

I/flutter ( 4682): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 4682): The following NoSuchMethodError was thrown building StreamBuilder<QuerySnapshot>(dirty, state:
I/flutter ( 4682): _StreamBuilderBaseState<QuerySnapshot, AsyncSnapshot<QuerySnapshot>>#7aca9):
I/flutter ( 4682): Class 'QuerySnapshot' has no instance getter 'document'.
I/flutter ( 4682): Receiver: Instance of 'QuerySnapshot'
I/flutter ( 4682): Tried calling: document
I/flutter ( 4682): 
I/flutter ( 4682): When the exception was thrown, this was the stack:
I/flutter ( 4682): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
I/flutter ( 4682): #1      _HomePageState.build.<anonymous closure> (file:///C:/Users/Pound/Desktop/test%20project/smart_parking/lib/Home.dart:63:44)
I/flutter ( 4682): #2      StreamBuilder.build (package:flutter/src/widgets/async.dart:410:74)
I/flutter ( 4682): #3      _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:124:48)
I/flutter ( 4682): #4      StatefulElement.build (package:flutter/src/widgets/framework.dart:3742:27)
I/flutter ( 4682): #5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3654:15)
I/flutter ( 4682): #6      Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
I/flutter ( 4682): #7      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2255:33)
I/flutter ( 4682): #8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:653:20)
I/flutter ( 4682): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter ( 4682): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter ( 4682): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter ( 4682): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter ( 4682): #13     _invoke (dart:ui/hooks.dart:128:13)
I/flutter ( 4682): #14     _drawFrame (dart:ui/hooks.dart:117:3)
I/flutter ( 4682): ════════════════════════════════════════════════════════════════════════════════════════════════════

and this Another exception was thrown: NoSuchMethodError: Class 'QuerySnapshot' has no instance getter 'document'.

how can i fix that thank you 

Jonas Sander

unread,
Sep 19, 2018, 4:39:14 PM9/19/18
to Flutter Dev
The QuerySnapshot class has no getter called "document", you probably meant "documents".

So you can call querySnapshot.documents, which is a "List<DocumentSnapshot>" from what i can remember from the top of my head.

Hope that'll help!

Reply all
Reply to author
Forward
0 new messages