Reputation: 43
I am working on a Flutter project where I need to display the list of government agencies. I should implement two levels of filters. 1. State to which the agency belongs and 2. Service provided by the agency. So I have some choice chips to select the agent based on service and a checkbox-based dropdown for filtering states. As a result, I need to apply logical or based filters on state and service fields. Since that's impossible I thought of adding a helper field that holds both data in an array format. so that I could work on a single field with array-contains-any filter. Now there is one more problem, let's say there are twelve states and 5 services, and I am selecting 6 states and 3 services. I need to create a total of 18 arrays which is also not supported by Firestore as the maximum is 10. Please share with me an idea of any approach I could take;
Upvotes: 1
Views: 563
Reputation: 138824
Don't use arrays, simply use maps. There are no limitations regarding how many where equal methods are you chaining. The key of the Map will be the name of an agency and the value will be the boolean true. And you can add as many maps as you want.
Upvotes: 1