getXLS method

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

Implementation

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

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

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

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

  return result.future;
}