addHighlight method

dynamic addHighlight({
  1. required String cfi,
  2. Color color = Colors.yellow,
  3. double opacity = 0.3,
})

Adds a highlight to epub viewer

Implementation

addHighlight({
  ///Cfi string of the desired location
  required String cfi,

  ///Color of the highlight
  Color color = Colors.yellow,

  ///Opacity of the highlight
  double opacity = 0.3,
}) {
  var colorHex = color.toHex();
  var opacityString = opacity.toString();
  checkEpubLoaded();
  webViewController?.evaluateJavascript(
      source: 'addHighlight("$cfi", "$colorHex", "$opacityString")');
}