getSVG method

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

Implementation

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

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

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

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

  return result.future;
}