pushValue static method

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

Implementation

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

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

  return result;
}