increment static method
- @Deprecated('This function is deprecated, please use "Countly.instance.userProfile.increment" instead and do not forget to call "Countly.instance.userProfile.save"')
- String keyName
Increment user property by 1 returns the error or success message
Implementation
@Deprecated('This function is deprecated, please use "Countly.instance.userProfile.increment" instead and do not forget to call "Countly.instance.userProfile.save"')
static Future<String?> increment(String keyName) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "increment"';
log('increment, $message', logLevel: LogLevel.ERROR);
return message;
}
log('Calling "increment":[$keyName]');
if (keyName.isEmpty) {
String error = 'increment, key cannot be empty';
log(error);
return 'Error : $error';
}
List<String> args = [];
args.add(keyName);
final String? result = await _channel.invokeMethod('userData_increment', <String, dynamic>{'data': json.encode(args)});
return result;
}