UDocAnnotationController class

Owns every markup and bookmark of one document.

Works fully offline (optionally persisted to ULocalStorage under storageKey) and exposes export/import so an app can sync the same payload with a server. onChanged fires after every user change.

Inheritance

Constructors

UDocAnnotationController({String? storageKey, void onChanged(UDocAnnotationController controller)?, String? initialData, int maxUndo = 60, Color? color, String author = ""})

Properties

author → String
final
bookmarks → List<UDocBookmark>
no setter
canRedo → bool
no setter
canUndo → bool
no setter
color ↔ Color
getter/setter pair
grouped → List<List<UDocMarkup>>
Markups grouped by selection, sorted in reading order.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isEmpty → bool
no setter
kind ↔ UDocMarkupKind
getter/setter pair
markups → List<UDocMarkup>
no setter
maxUndo → int
final
noteCount → int
no setter
onChanged → void Function(UDocAnnotationController controller)?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shapes → List<UDocShape>
Free drawings, shapes, text boxes and sticky notes (see UDocShapeLayer).
no setter
storageKey → String?
no setter
updatedAt → DateTime
no setter

Methods

add(UDocMarkup markup) → UDocMarkup
addAll(List<UDocMarkup> markups) → void
addBookmark({required int pageIndex, int blockIndex = -1, double progress = -1, String title = "", String note = ""}) → UDocBookmark
Adds a position bookmark (several per page/chapter are allowed).
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addShape(UDocShape shape) → UDocShape
attachStorage(String key) → Future<void>
Binds persistence to key (for example after the document fingerprint is known) and loads it.
bookmarkOn(int pageIndex) → UDocBookmark?
bookmarksOn(int pageIndex) → List<UDocBookmark>
bringShapeToFront(String id) → void
byId(String id) → UDocMarkup?
clear() → void
clearShapes({int? pageIndex}) → void
Removes every shape, or only those of pageIndex.
dispose() → void
Discards any resources used by the object.
override
duplicateShape(String id) → UDocShape?
Copies a shape slightly offset and returns the copy.
export({bool base64 = true}) → String
Base64 of the JSON payload — a compact, transport-safe string for servers.
group(String groupKey) → List<UDocMarkup>
import(String data, {bool merge = false, bool notify = true}) → bool
Accepts export output (base64 or raw JSON) and the legacy SinApp {"markers": [...], "pageMarks": [...]} format. Returns false when the payload is not understood.
isBookmarked(int pageIndex) → bool
load() → Future<void>
markupsOn(int pageIndex) → List<UDocMarkup>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
redo() → void
remove(String id) → void
removeBookmark(String id) → void
removeGroup(String groupKey) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeShape(String id) → void
replace(UDocMarkup markup) → void
resolvePlacement(String id, List<Rect> rects, {int? start, int? end, Map<String, Object?>? extra}) → void
Silently stores geometry computed after the fact (no undo entry).
save() → Future<void>
sendShapeToBack(String id) → void
shapeById(String id) → UDocShape?
shapesOn(int pageIndex) → List<UDocShape>
Shapes of one PDF page / EPUB chapter, in paint order.
shapesOnBlock(int pageIndex, int blockIndex) → List<UDocShape>
Shapes of one EPUB paragraph.
toggleBookmark(int pageIndex, {String title = "", int blockIndex = -1, double progress = -1}) → UDocBookmark
toJson() → Map<String, Object?>
toMarkdown({String title = "", String pageLabel(int pageIndex)?}) → String
A readable Markdown summary of every note, highlight and bookmark.
toString() → String
A string representation of this object.
inherited
undo() → void
updateBookmark(UDocBookmark bookmark) → void
updateGroup(String groupKey, {UDocMarkupKind? kind, Color? color, String? note}) → void
Updates a whole selection group at once (colour, kind or note).
updateShape(UDocShape shape) → void
Replaces a shape. Rapid edits of the same shape (dragging, resizing) share one undo step and one save.

Operators

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

Static Methods

decode(String data) → Map<String, Object?>?
pickNewest(String first, String second) → String
Chooses the most recently updated of two exported payloads (for local vs. server sync).

Constants

formatVersion → const int