Clause class

Creates a condition to filter your Collection

field must be provided and is normally the string representation of the field on your document to match against.

It's recommended to store field names on your model so you can access them with MyModel.field<YourField> where MyModel references the class you're serializing your Document into, and field<YourField> is the naming convention to follow (don't include the angle brackets).

Examples

Good

Clause(MyModel.fieldAge, isEqualTo: 23);

Bad - Throws TooManyArgumentsException

Clause(MyModel.fieldVehicle, isEqualTo: 'Mazda', isNotEqualTo: 'Honda');

Constructors

Clause(String field, {Object? isEqualTo, Object? isNotEqualTo, Object? isLessThan, Object? isLessThanOrEqualTo, Object? isGreaterThan, Object? isGreaterThanOrEqualTo, Object? arrayContains, List<Object?>? arrayContainsAny, List<Object?>? whereIn, List<Object?>? whereNotIn, bool? isNull})

Properties

arrayContains Object?
final
arrayContainsAny List<Object?>?
final
field String
final
hashCode int
The hash code for this object.
no setterinherited
isEqualityOrInComparison bool
final
isEqualTo Object?
final
isGreaterThan Object?
final
isGreaterThanOrEqualTo Object?
final
isLessThan Object?
final
isLessThanOrEqualTo Object?
final
isNotEqualTo Object?
final
isNull bool?
final
isRangeComparison bool
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
whereIn List<Object?>?
final
whereNotIn List<Object?>?
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

getEqualityOrInComparisonFields(List<Clause> clauses) List<String>
Get a subset of the given clauses that are either equality or in (contains) comparisons
hasEqualityOrInComparison(List<Clause> clauses) bool
Checks to see whether any of the clauses given are equality or in (contains) comparisons
hasMoreThanOneFieldInRangeComparisons(List<Clause> clauses) bool
Checks to see if more than one field is found between all range comparisons
hasRangeComparison(List<Clause> clauses) bool
Checks to see whether any of the clauses given are range comparisons