AnnotationProperties class
Data class for annotation properties that provides type-safe access to annotation attributes while preserving attachments and custom data.
This class is used with the AnnotationManager API to safely update annotation properties without losing data during the update process.
Usage Pattern:
// Get current properties
final properties = await annotationManager.getAnnotationProperties(pageIndex, annotationId);
// Create modified version
final updated = properties?.withColor(Colors.red).withOpacity(0.7);
// Save changes
if (updated != null) {
await annotationManager.saveAnnotationProperties(updated);
}
Data Preservation: Unlike the deprecated updateAnnotation method,
this approach preserves attachments, custom data, and other properties
that are not being explicitly modified.
Note on inkLines, customData, bbox, and flags: These fields are serialized as JSON
strings internally to avoid Pigeon's CastList type casting issues. Use the
extension methods for typed access (e.g., inkLines, customData, boundingBox, flagsSet).
Constructors
- AnnotationProperties({required String annotationId, required int pageIndex, int? strokeColor, int? fillColor, double? opacity, double? lineWidth, String? flagsJson, String? customDataJson, String? contents, String? subject, String? creator, String? bboxJson, String? note, String? inkLinesJson, String? fontName, double? fontSize, String? iconName})
Properties
- annotationId ↔ String
-
Unique identifier for the annotation
getter/setter pair
-
bbox
→ List<
double> ? -
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the bounding box as a list of doublesx, y, width, height. Decodes from the internal JSON string representation.no setter - bboxJson ↔ String?
-
Bounding box as a JSON string array
x, y, width, heightin PDF coordinates. Use theboundingBoxgetter from the extension for typed access as Rect.getter/setter pair - boundingBox → Rect?
-
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the bounding box as a Flutter Rect object. Decodes from the internal JSON string representation.no setter - color → Color?
-
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the stroke color as a Flutter Color object.no setter - contents ↔ String?
-
Text content of the annotation (for text-based annotations)
getter/setter pair
- creator ↔ String?
-
Creator/author of the annotation
getter/setter pair
-
customData
→ Map<
String, Object?> ? -
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the custom data as a typed Map. Decodes from the internal JSON string representation.no setter - customDataJson ↔ String?
-
Custom data associated with the annotation as a JSON string.
Use the
customDatagetter from the extension for typed access. This preserves any application-specific metadata.getter/setter pair - fillColor ↔ int?
-
Fill color as ARGB integer (e.g., 0xFF0000FF for blue)
getter/setter pair
- fillColorValue → Color?
-
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the fill color as a Flutter Color object.no setter -
flags
→ List<
String> ? -
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the flags as a list of strings. Decodes from the internal JSON string representation.no setter - flagsJson ↔ String?
-
Annotation flags as a JSON string array (e.g., '
"readOnly", "print"'). Use theflagsSetgetter from the extension for typed access as Setgetter/setter pair -
flagsSet
→ Set<
AnnotationFlag> ? -
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the flags as a Set of AnnotationFlag enums. Decodes from the internal JSON string representation. Skips any flag names that don't match a valid AnnotationFlag value (e.g., Web SDK may return 'noPrint' which maps to the 'print' flag).no setter - fontName ↔ String?
-
Font name for text annotations
getter/setter pair
- fontSize ↔ double?
-
Font size for text annotations (in points)
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconName ↔ String?
-
Icon name for note annotations (e.g., 'Comment', 'Key', 'Note')
getter/setter pair
-
inkLines
→ List<
List< ?List< >double> > -
Available on AnnotationProperties, provided by the AnnotationPropertiesGetters extension
Gets the ink lines as a typed nested list. Decodes from the internal JSON string representation. Format: [[x, y, pressure, ...], ...]no setter - inkLinesJson ↔ String?
-
Ink lines for ink annotations as a JSON string.
Use the
inkLinesgetter from the extension for typed access. Format: [[x, y, pressure, ...], ...] Each line is an array of points, each point isx, y, pressure.getter/setter pair - lineWidth ↔ double?
-
Line width for stroke-based annotations (in points)
getter/setter pair
- note ↔ String?
-
Note text associated with the annotation
getter/setter pair
- opacity ↔ double?
-
Opacity value between 0.0 (transparent) and 1.0 (opaque)
getter/setter pair
- pageIndex ↔ int
-
Zero-based page index where the annotation is located
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeColor ↔ int?
-
Stroke color as ARGB integer (e.g., 0xFFFF0000 for red)
getter/setter pair
- subject ↔ String?
-
Subject/title of the annotation
getter/setter pair
Methods
-
encode(
) → Object -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withBoundingBox(
Rect bbox) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated bounding box. -
withColor(
Color color) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated stroke color. -
withContents(
String contents) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated contents. -
withCreator(
String creator) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated creator. -
withCustomData(
Map< String, Object?> customData) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated custom data. -
withFillColor(
Color color) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated fill color. -
withFlags(
Set< AnnotationFlag> flags) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated flags. -
withFont(
String fontName, double fontSize) → AnnotationProperties -
Available on AnnotationProperties, provided by the FreeTextAnnotationProperties extension
Creates a modified copy with updated font. -
withIcon(
NoteIcon iconName) → AnnotationProperties -
Available on AnnotationProperties, provided by the NoteAnnotationProperties extension
Creates a modified copy with updated icon. -
withInkLines(
List< List< lines) → AnnotationPropertiesOffset> > -
Available on AnnotationProperties, provided by the InkAnnotationProperties extension
Creates a modified copy with updated ink lines. Accepts a list of lines where each line is a list of Offset points. Points are converted tox, y, pressureformat with default pressure of 1.0. -
withLineWidth(
double lineWidth) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated line width. -
withNote(
String note) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated note. -
withOpacity(
double opacity) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated opacity. -
withRawInkLines(
List< List< inkLines) → AnnotationPropertiesList< >double> > -
Available on AnnotationProperties, provided by the InkAnnotationProperties extension
Creates a modified copy with updated raw ink lines. Accepts ink lines in the native format: [[x, y, pressure, ...], ...] -
withSubject(
String subject) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with updated subject. -
withUpdates(
{Color? color, Color? fillColor, double? opacity, double? lineWidth, Set< AnnotationFlag> ? flags, Map<String, Object?> ? customData, String? contents, String? subject, String? creator, Rect? boundingBox, String? note}) → AnnotationProperties -
Available on AnnotationProperties, provided by the AnnotationPropertiesModification extension
Creates a modified copy with multiple updates.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
decode(
Object result) → AnnotationProperties