startDocumentErrorListener function

CancelListener startDocumentErrorListener(
  1. DocumentErrorListener listener
)

Listens for errors that could occur while PdftronFlutter.openDocument or DocumentViewController.openDocument is loading the file.

var documentErrorCancel = startDocumentErrorListener(() {
  print('flutter document loaded unsuccessfully');
});

Returns a function that can cancel the listener.

Implementation

CancelListener startDocumentErrorListener(DocumentErrorListener listener) {
  var subscription = _documentErrorChannel
      .receiveBroadcastStream(eventSinkId.documentErrorId.index)
      .listen((stub) {
    listener();
  }, cancelOnError: true);

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