I have a collection with one array that holds userId's.
I know I only have 2 users in the incoming array. I tried the following snip but I am getting an error
Future getChat({required List<String> userIdsArr}) async {
print('userIdsArr[0]: ${userIdsArr[0]}');
print('userIdsArr[1]: ${userIdsArr[1]}');
var data = await chat.where(
'User ids', 'array-contains-any', ['firebase', 'react']).snapshots();
print(data);
}
error I am getting here is
Error: Too many positional arguments: 1 allowed, but 3 found.
lib/…/cloud/firebase_cloud_storage.dart:44
Try removing the extra positional arguments.
var data = await chat.where(
^
CodePudding user response:
The syntax for building a query in Flutter is slightly different. If your chat
is a query or collection reference, the array-contains-any
would be:
chat.where('User ids', arrayContainsAny: ['firebase', 'react'])
Also see the Dart/Flutter code sample for array-contains-any
in the documentation.