setOnce static method
Implementation
@Deprecated('Use "Countly.instance.userProfile.setOnce" instead')
static Future<String?> setOnce(String keyName, String setOnce) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "setOnce"';
log('setOnce, $message', logLevel: LogLevel.ERROR);
return message;
}
log('Calling "setOnce":[$keyName], Value:[$setOnce]');
if (keyName.isEmpty) {
String error = 'setOnce, key cannot be empty';
log(error);
return 'Error : $error';
}
if (setOnce.isEmpty) {
String error = 'setOnce, value cannot be empty';
log(error);
return 'Error : $error';
}
List<String> args = [];
args.add(keyName);
args.add(setOnce);
final String? result = await _channel.invokeMethod('userData_setOnce', <String, dynamic>{'data': json.encode(args)});
return result;
}