ServerIncrementable<T extends num> class
A virtual incrementable value that can either be just a plain numeric value or an increment.
Using the server incrementable allows you to store numbers in the realtime database with the option to increment them. You can either set it to a value, in which case that value will simply be stored on the server. Alternatively, you can create an increment, which will increment the server value by the given amount and return the new value upon being stored.
Important: To use the ServerIncrementable, it must be registered with hive. See ServerIncrementableHiveAdapter for details on how to do that.
- Annotations
-
- @freezed
Constructors
- ServerIncrementable.increment(T increment)
-
Creates an increment placeholder that will increment the current server
value by the given
increment
. If the value wasnull
, it will simply be set to that value.constfactory - ServerIncrementable.value(T value)
-
Creates a server incrementable from a
value
.constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
Returns the current value of the incrementable
no setter
Methods
-
map<
TResult extends Object?> ({required TResult increment(_Increment< T> value), required TResult value(_Value<T> value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> ({TResult increment(_Increment< T> value)?, TResult value(_Value<T> value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> ({TResult increment(_Increment< T> value)?, TResult value(_Value<T> value)?, required TResult orElse()}) → TResult -
inherited
-
maybeWhen<
TResult extends Object?> ({TResult increment(T increment)?, TResult value(T value)?, required TResult orElse()}) → TResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult increment(T increment), required TResult value(T value)}) → TResult -
inherited
-
whenOrNull<
TResult extends Object?> ({TResult increment(T increment)?, TResult value(T value)?}) → TResult? -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited