FieldValue.minimum constructor

FieldValue.minimum(
  1. num value
)

Sets the field to the smaller of its current value and value.

If the current value is not a number, the field is set to the given value. If both are numbers they are compared numerically (NaN wins over any other number); the field keeps the type (integer or double) of the smaller operand, and keeps its current value and type if they are equivalent.

await firestore.doc('stats/today').update(<String, Object?>{
  'lowest': FieldValue.minimum(12),
});

Implementation

factory FieldValue.minimum(num value) {
  return _NumericMinimumFieldValue(value);
}