getFeedbackWidgetData static method

Future<List> getFeedbackWidgetData(
  1. CountlyPresentableFeedback widgetInfo, {
  2. dynamic onFinished(
    1. Map<String, dynamic> widgetData,
    2. String? error
    )?,
})

Downloads widget info and returns widgetData, error CountlyPresentableFeedback widgetInfo - identifies the specific widget for which you want to download widget data

Implementation

static Future<List> getFeedbackWidgetData(CountlyPresentableFeedback widgetInfo, {Function(Map<String, dynamic> widgetData, String? error)? onFinished}) async {
  Map<String, dynamic> widgetData = {};
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "getFeedbackWidgetData"';
    log('reportFeedbackWidgetManually, $message', logLevel: LogLevel.ERROR);
    return [widgetData, message];
  }
  _feedbackWidgetDataCallback = onFinished;
  String widgetId = widgetInfo.widgetId;
  String widgetType = widgetInfo.type;
  log('Calling "getFeedbackWidgetData":[$presentFeedbackWidget] with Type:[$widgetType]');
  String? error;
  List<String> args = [];
  args.add(widgetId);
  args.add(widgetType);
  args.add(widgetInfo.name);

  try {
    Map<dynamic, dynamic> retrievedWidgetData = await _channel.invokeMethod('getFeedbackWidgetData', <String, dynamic>{'data': json.encode(args)});
    widgetData = Map<String, dynamic>.from(retrievedWidgetData);
  } on PlatformException catch (e) {
    error = e.message;
    log('getAvailableFeedbackWidgets Error : $error');
  }
  return [widgetData, error];
}