firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

Cloud_firestore-0.8.2+3 plugin - arrayContains issue #570

Closed kroikie closed 4 years ago

kroikie commented 5 years ago

Steps to Reproduce

Using cloud_firestore: ^0.8.2+3 plugin version:

When trying to filter collections using arrayContains it only works with arrays of Strings. Example:

return _firestore
        .collection('myCollection')
        .where('myArray', arrayContains: 'someStringValue')
        .getDocuments();

If we try to filter some array of maps/objects it doesn't work. Example:

return _firestore
        .collection('myCollection')
        .where('myArray', arrayContains: { "brandId": "6BYbMjTjT2aRFo2eGlQH" })
        .getDocuments();

Logs

flutter analyze

Analyzing minhaestufa...                                         

   info • Unused import: 'package:greenhouse/domain/entity/greenhouse.dart' • lib/domain/service/dashboard_service.dart:5:8 •
          unused_import
   info • Unused import: 'package:greenhouse/domain/entity/greenhouse_revestimento.dart' •
          lib/domain/service/dashboard_service.dart:6:8 • unused_import
   info • Unused import: 'package:rxdart/rxdart.dart' • lib/domain/service/dashboard_service.dart:9:8 • unused_import
   info • The value of the field '_greenhouseService' isn't used • lib/domain/service/dashboard_service.dart:13:21 • unused_field
   info • The value of the local variable 'farmGrenhouses' isn't used • lib/domain/service/dashboard_service.dart:32:37 •
          unused_local_variable
   info • Close instances of `dart.core.Sink` • lib/view/screen/cart/bloc/cart_bloc.dart:34:9 • close_sinks
   info • The left operand uses '?.', so its value can be null • lib/view/screen/cart/cart_page.dart:93:59 •
          null_aware_before_operator
   info • The value of the field '_greenhouseService' isn't used • lib/view/screen/farm/bloc/farm_bloc.dart:18:27 • unused_field
   info • The value of the local variable 'a' isn't used • lib/view/screen/greenhouse/bloc/greenhouse_bloc.dart:130:11 •
          unused_local_variable
   info • Close instances of `dart.core.Sink` • lib/view/screen/greenhouse/detail/bloc/revestimento_bloc.dart:31:9 • close_sinks
   info • Close instances of `dart.core.Sink` • lib/view/screen/greenhouse/detail/bloc/revestimento_bloc.dart:35:9 • close_sinks
   info • Close instances of `dart.core.Sink` • lib/view/screen/greenhouse/detail/bloc/revestimento_bloc.dart:39:9 • close_sinks
   info • Close instances of `dart.core.Sink` • lib/view/screen/greenhouse/detail/bloc/revestimento_bloc.dart:45:9 • close_sinks
   info • Close instances of `dart.core.Sink` • lib/view/screen/greenhouse/detail/bloc/revestimento_bloc.dart:51:9 • close_sinks
   info • The value of the '?.' operator can be 'null', which isn't appropriate in a condition •
          lib/view/screen/greenhouse/detail/greenhouse_composition_page.dart:234:21 • null_aware_in_condition
   info • The value of the '?.' operator can be 'null', which isn't appropriate in a condition •
          lib/view/screen/greenhouse/detail/greenhouse_composition_page.dart:370:21 • null_aware_in_condition
   info • The value of the '?.' operator can be 'null', which isn't appropriate as an operand of a logical operator •
          lib/view/screen/greenhouse/detail/greenhouse_detail_page.dart:307:10 • null_aware_in_logical_operator
   info • The value of the local variable 'a' isn't used • lib/view/screen/user/register_password_page.dart:60:21 •
          unused_local_variable

18 issues found. (ran in 6.4s)

flutter doctor -v

[✓] Flutter (Channel beta, v0.11.3, on Mac OS X 10.13.6 17G3025, locale en-BR)
    • Flutter version 0.11.3 at /Users/vsossella/development/flutter
    • Framework revision 72bf075e8d (11 days ago), 2018-11-09 20:36:17 -0800
    • Engine revision 5646e86a6f
    • Dart version 2.1.0 (build 2.1.0-dev.9.3 9c07fb64c4)

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/vsossella/Library/Android/sdk
    • Android NDK at /Users/vsossella/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.29.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.20.0

[✓] Connected device (1 available)
    • SM G950F • ce0317137327e00b0c • android-arm64 • Android 8.0.0 (API 26)

• No issues found!
kroikie commented 5 years ago

@ViniciusSossela

The issue at https://github.com/flutter/flutter/issues/24609 has been closed and moved here. Future collaboration on this issue will be done here.

iapicca commented 5 years ago

Hi @ViniciusSossela If you are still experiencing this issue with the latest version of Flutter and FlutterFire plugin can you please provide your updated flutter doctor -v and your and your flutter run --verbose/flutter build --verbose ? Also, to better address the issue, would be helpful if you could post a self contained app on github or the steps to reproduce it. Thank you

iapicca commented 4 years ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please. All system setups can be slightly different so its always better to open new issues and reference related issues.