I am learning flutter and have just updated app to include Riverpods. I have a collection within a collection and so need to pass two parameters. One is called localAuthId and the other is called orgId.
When I setup the Streambuilder I get an error saying there are too many positional arguments.
Here is the snippet that seems to be causing the problem
**final orgStreamProvider =
StreamProvider.autoDispose.family<Org, String>((ref, localAuthId, orgId) {
final database = ref.watch(databaseProvider);
return database != null && localAuthId != null && orgId !=null
? database.orgDocStream(localAuthId: localAuthId, orgId: orgId)
: const Stream.empty();
})**
When I run the following on the top level collection i.e. with just 1 parameter of localAuthId it works just fine.
**final orgStreamProvider =
StreamProvider.autoDispose.family<Org, String>((ref, localAuthId) {
final database = ref.watch(databaseProvider);
return database != null && localAuthId != null
? database.orgDocStream(localAuthId: localAuthId)
: const Stream.empty();
});**
Does anyone know what I am getting wrong with this please?
Thank you
As of now, You can pass only one value to the provider using family of Riverpod. Better create one class with two properties and pass the object to the provider.
With
hooks_riverpod