FieldValue.maximum constructor

FieldValue.maximum(
  1. num value
)

Sets the field to the larger 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 larger operand, and keeps its current value and type if they are equivalent.

await firestore.doc('stats/today').update(<String, Object?>{
  'highest': FieldValue.maximum(31.5),
});

Implementation

factory FieldValue.maximum(num value) {
  return _NumericMaximumFieldValue(value);
}