openPublication method

Future<Publication> openPublication(
  1. String pubUrl
)

Opens a publication for reading from the given URL. This is required before any reading-related operations can be performed on the publication.

Returns a Publication object representing the opened publication.

If pubUrl is already open, returns the open publication without reloading it. Call closePublication first to reload.

Implementation

Future<Publication> openPublication(String pubUrl) async {
  try {
    return await _readiumCall(() => _platform.openPublication(pubUrl));
  } on PlatformException {
    rethrow;
  } catch (err) {
    _log.e('OpenPublication error: ${err.toString()}');
    throw ReadiumException.fromError(err);
  }
}