getCurrentLocation method

Future<EpubLocation> getCurrentLocation()

Returns current location of epub viewer

Implementation

Future<EpubLocation> getCurrentLocation() async {
  checkEpubLoaded();
  _cancelIfPending(currentLocationCompleter, 'Cancelled by new request');
  _currentLocationRequestId++;
  currentLocationCompleter = Completer<EpubLocation>();
  await webViewController?.callAsyncJavaScript(
    functionBody: 'getCurrentLocation(requestId)',
    arguments: {'requestId': _currentLocationRequestId},
  );
  return await currentLocationCompleter.future;
}