'Flutter Firestore Query Error Occurred While Parsing Query Arguments

I have an existing iOS and Android app which I have added Flutter to. Everything is working as intended. I am able to initialize Firebase and log in anonymously using Firebase Authentication. However, when I try to query the Firestore Database I get the following error:

An error occurred while parsing query arguments, this is most likely an error with this SDK. (
    0   CoreFoundation                      0x00007fff20406d44 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff201a4a65 objc_exception_throw + 48
    2   myApp Dev                        0x000000010aa64196 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 106
    3   myApp Dev                        0x000000010aa63d0c _ZN8firebase9firestore4util5ThrowENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 10
    4   myApp Dev                        0x000000010aa8b269 _ZN8firebase9firestore4util17ThrowIllegalStateIJEEEvPKcDpRKT_ + 47
    5   myApp Dev                        0x000000010aa737d9 _ZN8firebase9firestore3api9Firestore12set_settingsERKNS1_8SettingsE + 175
    6   myApp Dev                        0x000000010aa8bbb1 -[FIRFirestore setSettings:] + 132
    7   myApp Dev                        0x000000010aca0bb5 -[FLTFirebaseFirestoreReader FIRFirestore] + 597
    8   myApp Dev                        0x000000010ac9e9d9 -[FLTFirebaseFirestoreReader readValueOfType:] + 1449
    9   Flutter                             0x000000010f0b8a0f -[FlutterStandardReader readValueOfType:] + 680
    10  myApp Dev                        0x000000010ac9eae7 -[FLTFirebaseFirestoreReader readValueOfType:] + 1719
    11  myApp Dev                        0x000000010ac9f0f9 -[FLTFirebaseFirestoreReader FIRQuery] + 73
    12  myApp Dev                        0x000000010ac9e9fb -[FLTFirebaseFirestoreReader readValueOfType:] + 1483
    13  Flutter                             0x000000010f0b8a0f -[FlutterStandardReader readValueOfType:] + 680
    14  myApp Dev                        0x000000010ac9eae7 -[FLTFirebaseFirestoreReader readValueOfType:] + 1719
    15  Flutter                             0x000000010f0b726b -[FlutterStandardMethodCodec decodeMethodCall:] + 76
    16  Flutter                             0x000000010f0b576e __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 37
    17  Flutter                             0x000000010eaef0f2 ___ZN7flutter25PlatformMessageHandlerIos21HandlePlatformMessageENSt3__110unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE_block_invoke + 86
    18  libdispatch.dylib                   0x000000010c4d5816 _dispatch_call_block_and_release + 12
    19  libdispatch.dylib                   0x000000010c4d6a5b _dispatch_client_callout + 8
    20  libdispatch.dylib                   0x000000010c4e5325 _dispatch_main_queue_drain + 1169
    21  libdispatch.dylib                   0x000000010c4e4e86 _dispatch_main_queue_callback_4CF + 31
    22  CoreFoundation                      0x00007fff20373261 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    23  CoreFoundation                      0x00007fff2036da56 __CFRunLoopRun + 2761
    24  CoreFoundation                      0x00007fff2036ca90 CFRunLoopRunSpecific + 562
    25  GraphicsServices                    0x00007fff2cb72c8e GSEventRunModal + 139
    26  UIKitCore                           0x00007fff2508e90e -[UIApplication _run] + 928
    27  UIKitCore                           0x00007fff25093569 UIApplicationMain + 101
    28  myApp Dev                        0x000000010a8d1638 main + 56
    29  dyld                                0x000000010baddf21 start_sim + 10
    30  ???                                 0x000000011abc451e 0x0 + 4743513374
)
2022-04-22 19:31:13.053635-0600 myApp Dev[4022:3041493] *** Assertion failure in -[FlutterStandardMethodCodec decodeMethodCall:], FlutterStandardCodec.mm:120
2022-04-22 19:31:13.061828-0600 myApp Dev[4022:3041493] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Corrupted standard method call'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff20406d44 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007fff201a4a65 objc_exception_throw + 48
    2   Foundation                          0x00007fff2075e634 _userInfoForFileAndLine + 0
    3   Flutter                             0x000000010f0b730b -[FlutterStandardMethodCodec decodeMethodCall:] + 236
    4   Flutter                             0x000000010f0b576e __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 37
    5   Flutter                             0x000000010eaef0f2 ___ZN7flutter25PlatformMessageHandlerIos21HandlePlatformMessageENSt3__110unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE_block_invoke + 86
    6   libdispatch.dylib                   0x000000010c4d5816 _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x000000010c4d6a5b _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x000000010c4e5325 _dispatch_main_queue_drain + 1169
    9   libdispatch.dylib                   0x000000010c4e4e86 _dispatch_main_queue_callback_4CF + 31
    10  CoreFoundation                      0x00007fff20373261 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    11  CoreFoundation                      0x00007fff2036da56 __CFRunLoopRun + 2761
    12  CoreFoundation                      0x00007fff2036ca90 CFRunLoopRunSpecific + 562
    13  GraphicsServices                    0x00007fff2cb72c8e GSEventRunModal + 139
    14  UIKitCore                           0x00007fff2508e90e -[UIApplication _run] + 928
    15  UIKitCore                           0x00007fff25093569 UIApplicationMain + 101
    16  myApp Dev                        0x000000010a8d1638 main + 56
    17  dyld                                0x000000010baddf21 start_sim + 10
    18  ???                                 0x000000011abc451e 0x0 + 4743513374
)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/username/Library/Developer/Xcode/DerivedData/myApp-efvmuyofdpilzaamxqttwccqckxt/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/username/Library/Developer/Xcode/DerivedData/myApp-efvmuyofdpilzaamxqttwccqckxt/Build/Products/Debug-iphonesimulator
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Corrupted standard method call'
terminating with uncaught exception of type NSException
CoreSimulator 802.6 - Device: iPhone 13 Pro (33D54B65-82B4-414D-9D65-AE129A62EB94) - Runtime: iOS 15.4 (19E240) - DeviceType: iPhone 13 Pro

My code is as follows:

      try {
        var snapshot =
            await FirebaseFirestore.instance.collection('users').get();
        inspect(snapshot);
        // List<dynamic> result =
        //     (snapshot as QuerySnapshot).docs.map((doc) => doc.data()).toList();
        // debugPrint(result.toString());
        // inspect(result);
      } catch (error) {
        debugPrint(error.toString());
      }

I have searched around for a solutions but nothing has worked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source