pushUniqueValue static method

  1. @Deprecated('This function is deprecated, please use "Countly.instance.userProfile.pushUnique" instead and do not forget to call "Countly.instance.userProfile.save"')
Future<String?> pushUniqueValue(
  1. String type,
  2. String pushUniqueValue
)

Implementation

@Deprecated('This function is deprecated, please use "Countly.instance.userProfile.pushUnique" instead and do not forget to call "Countly.instance.userProfile.save"')
static Future<String?> pushUniqueValue(String type, String pushUniqueValue) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "pushUniqueValue"';
    log('pushUniqueValue, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "pushUniqueValue":[$type], Value:[$pushUniqueValue]');
  if (type.isEmpty) {
    String error = 'pushUniqueValue, key cannot be empty';
    log(error);
    return 'Error : $error';
  }
  if (pushUniqueValue.isEmpty) {
    String error = 'pushUniqueValue, value cannot be empty';
    log(error);
    return 'Error : $error';
  }
  List<String> args = [];
  args.add(type);
  args.add(pushUniqueValue);

  final String? result = await _channel.invokeMethod('userData_pushUniqueValue', <String, dynamic>{'data': json.encode(args)});

  return result;
}