Skip to content

Get current counter value

Returns the current value of the counter.

Future<int> Backendless.counters.getValue(String counterName);

IAtomic counter = Backendless.counters.of(String counterName);
Future<int> counter.getValue();

where:

Argument                Description
counterName name of the counter to retrieve.

Example

Function callback = (counterValue) => print("current counter value is - $counterValue");

Backendless.counters.get("my counter").then(callback);

IAtomic myCounter = Backendless.counters.of("my counter");
myCounter.get().then(callback);

Codeless Reference

codeless_atomic_counters_get_counter_value_1

where:

Argument                Description
counter name Name of the counter whose value must be retrieved.

Returns the current value of the counter.

Consider the following counter:

codeless_atomic_counters_set_counter_if_2

The example below retrieves the current value of the counter. The result of this operation is 20.

codeless_atomic_counters_get_counter_value_2