getRemoteConfigValueForKey static method

  1. @Deprecated('This function is deprecated, please use "remoteConfigGetValue" instead')
Future<String?> getRemoteConfigValueForKey(
  1. String key,
  2. dynamic callback(
    1. String?
    )
)

Clear all remote config values. returns the error message or remote config value

Implementation

@Deprecated('This function is deprecated, please use "remoteConfigGetValue" instead')
static Future<String?> getRemoteConfigValueForKey(String key, Function(String?) callback) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "getRemoteConfigValueForKey"';
    log('getRemoteConfigValueForKey, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "getRemoteConfigValueForKey" with the key:[$key]');
  if (key.isEmpty) {
    String error = 'getRemoteConfigValueForKey, key cannot be empty';
    log(error);
    return 'Error : $error';
  }
  List<String> args = [];
  args.add(key);

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

  callback(result);
  return result;
}