ModelCounter class
Define the field as a counter.
The base value is given as value, and the value is increased or decreased by increment.
By passing this to the server, it is possible to stably increase or decrease the value.
フィールドをカウンターとして定義します。
ベースの値をvalueとして与え、incrementで値を増減していきます。
これをサーバーに渡すことで安定して値の増減を行うことができます。
- Inheritance
-
- Object
- ModelFieldValue<
int> - ModelCounter
- Implemented types
- Available Extensions
- Annotations
Constructors
- ModelCounter(int value)
-
Define the field as a counter.
constfactory
- ModelCounter.fromJson(DynamicMap json)
-
Convert from
json
map to ModelCounter.factory - ModelCounter.fromServer(int value)
-
Used to disguise the retrieval of data from the server.
constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- incrementValue → int
-
Obtains the increase/decrease value.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
Actual value.
no setteroverride
Methods
-
compareTo(
ModelCounter other) → int -
Compares this object to another object.
override
-
increment(
int val) → ModelCounter -
Increase or decrease the value with
val
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → DynamicMap -
Methods for Json serialization.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator +(
ModelCounter other) → ModelCounter - Add other ModelCounter as increment value.
-
operator -(
ModelCounter other) → ModelCounter - Subtracts other ModelCounter as the value of increment.
-
operator <(
ModelCounter other) → bool - Compare with other ModelCounter.
-
operator <=(
ModelCounter other) → bool - Compare with other ModelCounter.
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
ModelCounter other) → bool - Compare with other ModelCounter.
-
operator >=(
ModelCounter other) → bool - Compare with other ModelCounter.
-
operator unary-(
) → ModelCounter - Inverts the plus/minus of the increment and value values.
Constants
- kIncrementKey → const String
- Key to store the increase/decrease value.
- kSourceKey → const String
- Key to store the data source.
- kValueKey → const String
- Key to store the value.
- typeString → const String
- Type key.