Decimal128Value class

Represents a 128-bit decimal type in Firestore documents.

Only databases of the Enterprise edition store this type.

await firestore.doc('accounts/a').set(<String, Object?>{
  'balance': Decimal128Value('1234.5678'),
});
final DocumentSnapshot<Map<String, Object?>> snapshot =
    await firestore.doc('accounts/a').get();
final Decimal128Value? balance = snapshot.getDecimal128Value('balance');

Differences from the JS SDK: the constructor accepts only values that decimal128 holds exactly (the JS SDK accepts any and rounds), and the sum and average of an aggregation over such values are a Decimal128Value. In queries a decimal compares with the other numbers by its numeric value.

Constructors

Decimal128Value(String stringValue)
Creates a 128-bit decimal from its string representation, for example 1.5, -1.2e3, NaN, Infinity or -Infinity.

Properties

hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringValue → String
The string representation of the decimal, as it was provided.
final

Methods

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

Operators

operator ==(Object other) → bool
Two decimals are equal if they have the same numeric value, so 1.0 equals 1, and -0 equals 0.
override