giveConsent static method
Give consent for specific features. returns the error or success message
Implementation
static Future<String?> giveConsent(List<String> consents) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "giveConsent"';
log('giveConsent, $message', logLevel: LogLevel.ERROR);
return message;
}
String consentsString = consents.toString();
log('Calling "giveConsent":[$consentsString]');
if (consents.isEmpty) {
String error = 'giveConsent, consents List is empty';
log(error, logLevel: LogLevel.WARNING);
}
log(consents.toString());
final String? result = await _channel.invokeMethod('giveConsent', <String, dynamic>{'data': json.encode(consents)});
return result;
}