pullValue static method

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

remove value from array returns the error or success message

Implementation

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

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

  return result;
}