getAsModelCounter method
Retrieves the element of key
of type ModelCounter from Map.
If there is no element of key
in Map or the type does not match ModelCounter, ModelCounter whose value is defaultValue
is returned.
MapからModelCounter型のkey
の要素を取得します。
Mapにkey
の要素がない場合やModelCounterと型が合わない場合、defaultValue
が値となるModelCounterが返されます。
Implementation
ModelCounter getAsModelCounter(String key, [int defaultValue = 0]) {
if (!containsKey(key) || this[key] is! ModelCounter) {
return ModelCounter(defaultValue);
}
return this[key] as ModelCounter;
}