🐛 [cloud_firestore] Overload Query.where
to Accept a Map for Dynamic Query Construction
#12203
Labels
platform: all
Issues / PRs which are for all platforms.
plugin: cloud_firestore
type: enhancement
New feature or request
Feature Request: Overload
Query.where
to Accept a Map for Dynamic Query ConstructionProblem Statement
The current signature of the Query.where method in Firestore mandates setting each query parameter in a controlled manner. This method becomes cumbersome and less maintainable, particularly in scenarios where it is common practice to isolate the database infrastructure within an independent data access module. This module is often designed to be reused across different applications to promote code reuse and separation of concerns. With introduction of the ability to query on null fields, adapting the current method signature to accommodate this functionality results in extensive and complex conditional logic. Developers are forced to write more code to manage the presence or absence of query parameters, leading to bloated and less readable code.
Proposed Solution
To address this issue and facilitate integration with isolated data access modules, I propose adding an overloaded version of the
Query.where
method that accepts a Map of parameters. This would allow for more dynamic and concise query construction, as developers could programmatically build the Map based on the specific conditions required by each application that reuses the data access module.Current Method Signature
Proposed Method Signature
Example Usage
With the proposed overload, developers could build queries like this:
This approach would significantly reduce the complexity and verbosity of the code required to build queries, making it easier to maintain and understand.
Thank you for considering this feature request.
The text was updated successfully, but these errors were encountered: