getCSV method

Future<String> getCSV([
  1. HighchartsOptions? options
])

Implementation

Future<String> getCSV([HighchartsOptions? options]) async {
  final json = options == null ? '' : options.toJSON();
  final result = Completer<String>();

  HighchartsCallbackDart<dynamic>? callback;
  callback = (obj) {
    view.off('highcharts_flutter.getCSV', callback!);
    result.complete(obj[0].toString());
  };

  view.on('highcharts_flutter.getCSV', callback);

  await view.webViewController.runJavaScript('''(() => {
    const csv = highcharts_flutter.chart.exporting.getCSV($json);
    highcharts_flutter.callback('highcharts_flutter.getCSV', [csv]);
  })();''');

  return result.future;
}