Firestore error after null safety migration

84 views
Skip to first unread message

John Boudreaux

unread,
Mar 4, 2021, 10:02:00 PM3/4/21
to Flutter Development (flutter-dev)
My application is working fine before null safety migration. Afterwards I get a runtime error when attempting to read a record, "Error: [cloud_firestore/unknown] Expected a value of type '((Object?) => Object)?', but got one of type '(Object) => Object?'"

I thought maybe I did something wrong in the migration, so I created a new application with just the minimum to reproduce. It worked fine on flutter >=2.7.0 but when I changed to >2.12.0 to enable null safety, the same error occurred. It is occurring on the read from the firestore collection:

var s = await FirebaseFirestore.instance
  .collection('cautions')
  .snapshots()
  .first;


 

Suzuki Tomohiro

unread,
Mar 4, 2021, 10:07:16 PM3/4/21
to John Boudreaux, Flutter Development (flutter-dev)
Why is that “unknown”? No source file name or line number?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/54f421e5-7a2d-4ec3-aa63-9be671059788n%40googlegroups.com.

Chris Sells

unread,
Mar 4, 2021, 10:09:41 PM3/4/21
to Suzuki Tomohiro, John Boudreaux, Flutter Development (flutter-dev)

John Boudreaux

unread,
Mar 4, 2021, 10:11:38 PM3/4/21
to Flutter Development (flutter-dev)
I should mention, this is a web application. Flutterfire seems to have some firestore for web special source files.

Here is the whole stack trace:

Error: [cloud_firestore/unknown] Expected a value of type '((Object?) => Object)?', but got one of type '(Object) => Object?'
at Object.throw_ [as throw] (http://localhost:54863/dart_sdk.js:5032:11)
at Object._checkAndCall (http://localhost:54863/dart_sdk.js:5237:16)
at Object._invokeErrorHandler (http://localhost:54863/dart_sdk.js:37273:19)
at _HandleErrorStream.new.[_handleError] (http://localhost:54863/dart_sdk.js:35175:19)
at _ForwardingStreamSubscription.new.[_handleError] (http://localhost:54863/dart_sdk.js:34993:38)
at _RootZone.runBinaryGuarded (http://localhost:54863/dart_sdk.js:37034:11)
at _ForwardingStreamSubscription.new.[_sendError] (http://localhost:54863/dart_sdk.js:30983:11)
at _ForwardingStreamSubscription.new.[_addError] (http://localhost:54863/dart_sdk.js:30909:27)
at _ForwardingStreamSubscription.new.[_addError] (http://localhost:54863/dart_sdk.js:34968:25)
at Object._addErrorWithReplacement (http://localhost:54863/dart_sdk.js:37469:20)
at _MapStream.new.[_handleData] (http://localhost:54863/dart_sdk.js:35081:19)
at _ForwardingStreamSubscription.new.[_handleData] (http://localhost:54863/dart_sdk.js:34990:37)
at _RootZone.runUnaryGuarded (http://localhost:54863/dart_sdk.js:37018:11)
at _BroadcastSubscription.new.[_sendData] (http://localhost:54863/dart_sdk.js:30952:22)
at _BroadcastSubscription.new.[_add] (http://localhost:54863/dart_sdk.js:30901:26)
at _SyncBroadcastStreamController.new.[_sendData] (http://localhost:54863/dart_sdk.js:31595:34)
at _SyncBroadcastStreamController.new.add (http://localhost:54863/dart_sdk.js:31394:24)
at Object._checkAndCall (http://localhost:54863/dart_sdk.js:5237:16)
Application finished.
Exited (sigterm) 

John Boudreaux

unread,
Mar 5, 2021, 1:50:50 PM3/5/21
to Flutter Development (flutter-dev)
I opened an issue on github. The moderators closed it as a duplicate even though I searched for this beforehand. Alas, there is an issue open #5050.

John Boudreaux

unread,
Mar 5, 2021, 1:52:10 PM3/5/21
to Flutter Development (flutter-dev)
BTW, if you run it with 
```
flutter run --no-sound-null-safety 
```
It gets around them problem. So, we can still work while waiting on the fix.

Reply all
Reply to author
Forward
0 new messages