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