startDocumentLoadedListener function

CancelListener startDocumentLoadedListener(
  1. DocumentLoadedListener listener
)

Listens for when PdftronFlutter.openDocument or DocumentViewController.openDocument has finished loading the file.

var documentLoadedCancel = startDocumentLoadedListener((path) {
  print('flutter document loaded: $path');
});

Returns a function that can cancel the listener.

Implementation

CancelListener startDocumentLoadedListener(DocumentLoadedListener listener) {
  var subscription = _documentLoadedChannel
      .receiveBroadcastStream(eventSinkId.documentLoadedId.index)
      .listen(listener, cancelOnError: true);

  return () {
    subscription.cancel();
  };
}