PdfElement class sealed
Represents a single element in a PDF template.
This is a sealed class that can represent different types of content such as text, tables, images, barcodes, dividers, and spaces.
- Implementers
- Annotations
-
- @Freezed.new(unionKey: 'type', unionValueCase: FreezedUnionCase.snake)
Constructors
- PdfElement.barcode({String? visibleIfKey, String? data, String? dataKey, @Default.new(PdfTextAlignment.center) PdfTextAlignment alignment})
-
A barcode or QR code element.
constfactory
- PdfElement.divider()
-
A simple horizontal line divider.
constfactory
-
PdfElement.fromJson(Map<
String, dynamic> json) -
Factory for creating a PdfElement from a JSON map.
factory
- PdfElement.image({String? visibleIfKey, String? imageSource, String? dataKey, @Default.new(100.0) double width, @Default.new(100.0) double height, @Default.new(PdfTextAlignment.center) PdfTextAlignment alignment})
-
An image element that can load from a URL, local path, asset, or Base64.
constfactory
- PdfElement.space({@Default.new(10.0) double height})
-
A vertical space element.
constfactory
-
PdfElement.table({String? visibleIfKey, required String dataSourceKey, required Map<
String, String> columns, @Default.new(PdfTableBorderStyle.full) PdfTableBorderStyle borderStyle}) -
A table element that displays a dynamic list of data.
constfactory
- PdfElement.text({String? visibleIfKey, String? text, String? dataKey, @Default.new(PdfTextAlignment.left) PdfTextAlignment alignment})
-
A text element that can display static text or dynamic data from a key.
constfactory
Properties
- currentVisibleIfKey → String?
-
Gets the key used for conditional visibility, if applicable for this element.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
map<
TResult extends Object?> ({required TResult text(PdfTextElement value), required TResult table(PdfTableElement value), required TResult image(PdfImageElement value), required TResult barcode(PdfBarcodeElement value), required TResult divider(PdfDividerElement value), required TResult space(PdfSpaceElement value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> ({TResult? text(PdfTextElement value)?, TResult? table(PdfTableElement value)?, TResult? image(PdfImageElement value)?, TResult? barcode(PdfBarcodeElement value)?, TResult? divider(PdfDividerElement value)?, TResult? space(PdfSpaceElement value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> ({TResult text(PdfTextElement value)?, TResult table(PdfTableElement value)?, TResult image(PdfImageElement value)?, TResult barcode(PdfBarcodeElement value)?, TResult divider(PdfDividerElement value)?, TResult space(PdfSpaceElement value)?, required TResult orElse()}) → TResult -
inherited
-
maybeWhen<
TResult extends Object?> ({TResult text(String? visibleIfKey, String? text, String? dataKey, PdfTextAlignment alignment)?, TResult table(String? visibleIfKey, String dataSourceKey, Map< String, String> columns, PdfTableBorderStyle borderStyle)?, TResult image(String? visibleIfKey, String? imageSource, String? dataKey, double width, double height, PdfTextAlignment alignment)?, TResult barcode(String? visibleIfKey, String? data, String? dataKey, PdfTextAlignment alignment)?, TResult divider()?, TResult space(double height)?, required TResult orElse()}) → TResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this PdfElement to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult text(String? visibleIfKey, String? text, String? dataKey, PdfTextAlignment alignment), required TResult table(String? visibleIfKey, String dataSourceKey, Map< String, String> columns, PdfTableBorderStyle borderStyle), required TResult image(String? visibleIfKey, String? imageSource, String? dataKey, double width, double height, PdfTextAlignment alignment), required TResult barcode(String? visibleIfKey, String? data, String? dataKey, PdfTextAlignment alignment), required TResult divider(), required TResult space(double height)}) → TResult -
inherited
-
whenOrNull<
TResult extends Object?> ({TResult? text(String? visibleIfKey, String? text, String? dataKey, PdfTextAlignment alignment)?, TResult? table(String? visibleIfKey, String dataSourceKey, Map< String, String> columns, PdfTableBorderStyle borderStyle)?, TResult? image(String? visibleIfKey, String? imageSource, String? dataKey, double width, double height, PdfTextAlignment alignment)?, TResult? barcode(String? visibleIfKey, String? data, String? dataKey, PdfTextAlignment alignment)?, TResult? divider()?, TResult? space(double height)?}) → TResult? -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited