Where class
A condition that evaluates to true
in the Provider
should return Model.
This class should be exposed by the implemented ModelRepository
and not imported from
this package as repositories may choose to extend or inhibit functionality.
- Inheritance
-
- Object
- WhereCondition
- Where
Constructors
- Where.new(String evaluatedField, {dynamic value, Compare? compare, bool? isRequired})
-
A condition that evaluates to
true
in theProvider
should return Model.const - Where.exact(String evaluatedField, dynamic value, {bool isRequired = true})
-
A condition written with brevity.
isRequired
defaultstrue
.const
Properties
- compare → Compare
-
The kind of comparison of the evaluatedField to the value. Defaults to Compare.exact.
It is the responsibility of the
Provider
to ignore or interpret the requested comparison.final -
conditions
→ List<
WhereCondition> ? -
Nested conditions. Leave unchanged for
WhereCondition
s that do not nest.final - evaluatedField → String
-
The Dart name of the field. For example,
myField
when queryingfinal String myField
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isRequired → bool
-
Whether the condition(s) must evaluate to true. Defaults
true
.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → dynamic
-
The value to compare on the evaluatedField.
final
Methods
-
contains(
dynamic value) → Where - Convenience function to create a Where with Compare.contains.
-
doesNotContain(
dynamic value) → Where - Convenience function to create a Where with Compare.doesNotContain.
-
isBetween(
dynamic value1, dynamic value2) → Where - Convenience function to create a Where with Compare.between.
-
isExactly(
dynamic value) → Where - Convenience function to create a Where with Compare.exact.
-
isGreaterThan(
dynamic value) → Where - Convenience function to create a Where with Compare.greaterThan.
-
isGreaterThanOrEqualTo(
dynamic value) → Where - Convenience function to create a Where with Compare.greaterThanOrEqualTo.
-
isLessThan(
dynamic value) → Where - Convenience function to create a Where with Compare.lessThan.
-
isLessThanOrEqualTo(
dynamic value) → Where - Convenience function to create a Where with Compare.lessThanOrEqualTo.
-
isNot(
dynamic value) → Where - Convenience function to create a Where with Compare.notEqual.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serialize to JSON
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
byField(
String fieldName, List< WhereCondition> ? conditions) → List<WhereCondition> -
Recursively find conditions that evaluate a specific field. A field is a member on a model,
such as
myUserId
infinal String myUserId
. If the use case for the field only requires one result, sayid
orprimaryKey
, firstByField may be more useful. -
firstByField(
String fieldName, List< WhereCondition> ? conditions) → WhereCondition? - Find the first occurrance of a condition that evaluates a specific field For all conditions, use byField.