Repository navigation
Flutter and cloud_firestore - is not a subtype of type #15007
Description
Activity
- changed the title
[-]Flutter and cloud_firestore[/-][+]Flutter and cloud_firestore - is not a subtype of type[/+]on Mar 1, 2018 Sharing what kind of fields are defined in the collection/document will help the team to debug. There are some types which are not supported yet.
Could be a duplicate of #11799
/cc @collinjackson
i did another collection to test and same error:
- Collection ("example") -- Document (''test") --- field: "field_text"DocumentSnapshot result = await Firestore.instance.collection('example') .document("test") .get();same error in emulator and real device(with all the playservices ok)
and keep the same error
solved in version 0.2.10 (i was using 0.2.9)
changes -> flutter-team-archive/plugins@915e260
thanks guys =) that was fast
Still getting this issue on a recent version of flutter:
Flutter 0.3.6 • channel dev • https://github.com/flutter/flutter.git
Framework • revision be09a20 (4 days ago) • 2018-05-04 10:31:53 -0700
Engine • revision e976be1
Tools • Dart 2.0.0-dev.53.0.flutter-e6d7d67f4bspecifically when i try to utilize the json_serializable (https://pub.dartlang.org/packages/json_serializable) package to convert a record from Firebase to an object in Dart.
Reacted by 0xPixelfrostsame problem, is there any workaround?
Sorry for the late response, I had avoided this issue and worked on some other stuff in the project for a while. I think I figured out a fix, but it's extremely goofy...
Map<String, dynamic> mapJson = document.data; new MyObject.fromJson(json.decode(json.encode(mapJson))));
¯\(ツ)/¯
Reacted by paprika and MarsReacted by 0xPixelfrostI used this approach
if(json["key"]!= null){ this.active_guests = json["key"].cast<String, int>(); }
it works fine you just have to cast it to the proper types you want. I think this issue can be closedThis issue has been moved to firebase/flutterfire#899. Any further collaboration will be done there.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Aug 27, 2021
Steps to Reproduce
Logs
Run
flutter analyzeand attach any output of that command also.Flutter Doctor
-> No Issues found!