presentRatingWidgetWithID static method
Displays the feedback widget for the given ID returns the error or success message
Implementation
static Future<String?> presentRatingWidgetWithID(String widgetId, {String? closeButtonText, Function(String? error)? ratingWidgetCallback}) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "presentRatingWidgetWithID"';
log('presentRatingWidgetWithID, $message', logLevel: LogLevel.ERROR);
return message;
}
bool isCallback = ratingWidgetCallback != null ? true : false;
log('Calling "presentRatingWidgetWithID":[$widgetId] with callback:[$isCallback]');
if (widgetId.isEmpty) {
String error = 'presentRatingWidgetWithID, widgetId cannot be empty';
log(error);
return 'Error : $error';
}
_ratingWidgetCallback = ratingWidgetCallback;
closeButtonText = closeButtonText ??= '';
List<String> args = [];
args.add(widgetId);
args.add(closeButtonText);
final String? result = await _channel.invokeMethod('presentRatingWidgetWithID', <String, dynamic>{'data': json.encode(args)});
return result;
}