getRemoteConfigValueForKey static method

  1. @Deprecated('Use remoteConfigGetValue instead')
Future<String?> getRemoteConfigValueForKey(
  1. String key,
  2. dynamic callback(
    1. String?
    )
)

Implementation

@Deprecated('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;
}