Closed
Description
Error thrown is NoSuchMethodError: The method 'add' was called on null. Receiver: null Tried calling: add(Instance of 'QuerySnapshot')
:
I don't know why the error is happening, but I have traced down the reason. I'm assuming that my device never deregisters as an observer before it's hot restarted and it contributes to the issue. The attached video can explain the issue better than I can. Please ask for clarification as I'm unable to duplicate it since I don't understand it fully enough.
Video
In cloud_firestore-0.9.7/lib/src/firestore.dart
class Firestore {
Firestore({FirebaseApp app}) : app = app ?? FirebaseApp.instance {
if (_initialized) return;
channel.setMethodCallHandler((MethodCall call) async {
if (call.method == 'QuerySnapshot') {
final QuerySnapshot snapshot = QuerySnapshot._(call.arguments, this);
// THIS IS WHERE THE ERROR OCCURS👇🏾
_queryObservers[call.arguments['handle']].add(snapshot);
} else if (call.method == 'DocumentSnapshot') {
final DocumentSnapshot snapshot = DocumentSnapshot._(
call.arguments['path'],
_asStringKeyedMap(call.arguments['data']),
this,
);
Variables:
call.arguments['handle'] -> 7
_queryObservers (I just realized that this list starts at a higher number after I hot restart). This must be the cause.
Metadata
Metadata
Assignees
Labels
No labels