getAvailableFeedbackWidgets static method

Future<FeedbackWidgetsResponse> getAvailableFeedbackWidgets()

Get a list of available feedback widgets for this device ID

Implementation

static Future<FeedbackWidgetsResponse> getAvailableFeedbackWidgets() async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "reportFeedbackWidgetManually"';
    log('reportFeedbackWidgetManually, $message', logLevel: LogLevel.ERROR);
    return FeedbackWidgetsResponse([], message);
  }
  log('Calling "getAvailableFeedbackWidgets"');
  List<CountlyPresentableFeedback> presentableFeedback = [];
  String? error;
  try {
    final List<dynamic> retrievedWidgets = await _channel.invokeMethod('getAvailableFeedbackWidgets');
    presentableFeedback = retrievedWidgets.map((e) => CountlyPresentableFeedback.fromJson(e)).toList();
  } on PlatformException catch (e) {
    error = e.message;
    log('getAvailableFeedbackWidgets Error : $error');
  }
  FeedbackWidgetsResponse feedbackWidgetsResponse = FeedbackWidgetsResponse(presentableFeedback, error);

  return feedbackWidgetsResponse;
}