QueryBuilder class

QueryBuilder class for building complex queries with operators and relationships

Constructors

QueryBuilder()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() String
Build the query string for URL parameters
clear() → void
Clear all query parameters
clone() QueryBuilder
Clone the query builder
limit(int value) QueryBuilder
Set limit for pagination
multiFieldOr(List<String> fields, dynamic value, {String? operator}) QueryBuilder
Multi-field OR search (same value across multiple fields) Example: .multiFieldOr('name', 'email', 'john', operator: 'contains') Results in: name__or__email_contains=john
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset(int value) QueryBuilder
Set offset for pagination
or(String field, dynamic value) QueryBuilder
Add a simple OR condition using or prefix Example: .or('age__gte', 18).or('role', 'admin') Results in: orage_gte=18&orrole=admin
orContains(String field, String value) QueryBuilder
Add an OR condition with contains operator
orderByAsc(String field) QueryBuilder
Sort in ascending order
orderByDesc(String field) QueryBuilder
Sort in descending order
orEndsWith(String field, String value) QueryBuilder
Add an OR condition with ends with operator
orGreaterThan(String field, dynamic value) QueryBuilder
Add an OR condition with operator Example: .orGreaterThan('age', 18) -> orage_gt=18
orGreaterThanOrEqual(String field, dynamic value) QueryBuilder
Add an OR condition with greater than or equal operator
orGroup(String groupName, String field, dynamic value) QueryBuilder
Add a named OR group condition using or:groupname prefix Example: .orGroup('tier', 'isPremium', true).orGroup('tier', 'isVerified', true) Results in: or:tierisPremium=true&or:tierisVerified=true
orIn(String field, List values) QueryBuilder
Add an OR condition with in operator
orIsNull(String field, bool isNull) QueryBuilder
Add an OR condition with is null operator
orLessThan(String field, dynamic value) QueryBuilder
Add an OR condition with less than operator
orLessThanOrEqual(String field, dynamic value) QueryBuilder
Add an OR condition with less than or equal operator
orNotEqual(String field, dynamic value) QueryBuilder
Add an OR condition with not equal operator
orNotIn(String field, List values) QueryBuilder
Add an OR condition with not in operator
orStartsWith(String field, String value) QueryBuilder
Add an OR condition with starts with operator
populate(String field) QueryBuilder
Populate a relationship field Supports nested relationships like 'author' or 'post.author'
populateAll(List<String> fields) QueryBuilder
Populate multiple relationship fields
searchInFields(List<String> fields, String searchTerm) QueryBuilder
Convenience method for multi-field contains search Example: .searchInFields('name', 'email', 'username', 'john') Results in: name__or__email__or__username_contains=john
select(String field) QueryBuilder
Select specific fields to return
selectAll(List<String> fields) QueryBuilder
Select multiple fields to return
skip(int value) QueryBuilder
Skip documents (alias for offset)
sortBy(String field, {String order = 'asc'}) QueryBuilder
Sort by a field
take(int value) QueryBuilder
Take documents (alias for limit)
toString() String
A string representation of this object.
inherited
where(String field, dynamic value) QueryBuilder
Add an equality filter
whereAll(Map<String, dynamic> filters) QueryBuilder
Add multiple filters at once
whereContains(String field, String value) QueryBuilder
Contains text operator (case-insensitive substring match)
whereEndsWith(String field, String value) QueryBuilder
Ends with operator
whereGreaterThan(String field, dynamic value) QueryBuilder
Greater than operator
whereGreaterThanOrEqual(String field, dynamic value) QueryBuilder
Greater than or equal operator
whereIn(String field, List values) QueryBuilder
In array operator
whereIsNull(String field, bool isNull) QueryBuilder
Is null operator
whereLessThan(String field, dynamic value) QueryBuilder
Less than operator
whereLessThanOrEqual(String field, dynamic value) QueryBuilder
Less than or equal operator
whereNotEqual(String field, dynamic value) QueryBuilder
Not equal operator
whereNotIn(String field, List values) QueryBuilder
Not in array operator
whereStartsWith(String field, String value) QueryBuilder
Starts with operator

Operators

operator ==(Object other) bool
The equality operator.
inherited