incrementBy static method

  1. @Deprecated('Use "Countly.instance.userProfile.incrementBy" instead')
Future<String?> incrementBy(
  1. String keyName,
  2. int keyIncrement
)

Implementation

@Deprecated('Use "Countly.instance.userProfile.incrementBy" instead')
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;
}