NutrientControllerInterface class abstract

Pure interface for the Nutrient viewer controller.

This defines the public API surface that users interact with when controlling a PDF viewer. It is intentionally separate from the internal lifecycle plumbing in NutrientController.

Usage

Define your own controller type by extending this interface:

abstract class MyController implements NutrientControllerInterface {
  Future<int> getCurrentPageIndex();
  Future<void> goToPage(int pageIndex);
}

Then use it with NutrientView for type-safe access:

NutrientView<MyController>(
  documentPath: 'document.pdf',
  onControllerReady: (controller) async {
    final count = await controller.document.getPageCount();
    await controller.goToPage(5);
  },
)

Provided APIs

Properties

document NutrientDocumentInterface
The open PDF document and its document-level operations.
no setter
events Stream<NutrientEvent>
A broadcast stream of cross-platform typed SDK events.
no setter
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether the controller has been disposed.
no setter
isReady bool
Whether the controller is ready for use.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

convertPdfPointToViewPoint(int pageIndex, Offset point) Future<Offset>
Converts a point from PDF page coordinates to the page view's coordinate space.
convertViewPointToPdfPoint(int pageIndex, Offset point) Future<Offset>
Converts a point from the page view's coordinate space to PDF page coordinates.
dispose() Future<void>
Dispose of this controller and release resources.
enterAnnotationCreationMode([AnnotationTool? annotationTool]) Future<bool?>
Enters annotation creation mode for the specified annotationTool.
exitAnnotationCreationMode() Future<bool?>
Exits annotation creation mode and returns to normal viewer interaction.
getVisibleRect(int pageIndex) Future<Rect>
Gets the visible rect of the given page.
getZoomScale(int pageIndex) Future<double>
Gets the current zoom scale of the given page.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAnnotationConfigurations(Map<String, dynamic> configurations) Future<bool>
Sets annotation preset configurations for the viewer's annotation toolbar.
setAnnotationEditingToolbarItems(List<AnnotationEditingItem> items) Future<void>
Replaces the annotation editing / property toolbar (the bar shown when an annotation is selected) with items — reorder, add, or remove the property controls / actions.
setAnnotationMenuConfiguration(Map<String, dynamic> configuration) Future<bool>
Configures the annotation context menu (items to show, disable, or hide).
setAnnotationToolbarItems(List<AnnotationToolbarItem> items) Future<void>
Replaces the viewer's annotation creation toolbar (the tool picker) with items — reorder, add, remove, or group the annotation tools.
setMainToolbarItems(List<ToolbarItem> items) Future<void>
Replaces the viewer's main toolbar with items.
toString() String
A string representation of this object.
inherited
zoomToRect(int pageIndex, Rect rect) Future<void>
Zooms to the given rect on the given page.

Operators

operator ==(Object other) bool
The equality operator.
inherited