getFeedbackWidgetData static method
Future<List>
getFeedbackWidgetData(
- CountlyPresentableFeedback widgetInfo, {
- dynamic onFinished()?,
Downloads widget info and returns widgetData, error
CountlyPresentableFeedback widgetInfo
- identifies the specific widget for which you want to download widget data
returns a List widgetData and error message
if any.
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('getFeedbackWidgetData, $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('getFeedbackWidgetData Error : $error');
}
return [widgetData, error];
}