InputRichBlock class sealed

This object represents a block in a rich formatted message to be sent.

Available extensions
Annotations
  • @Freezed.new(unionKey: 'type', unionValueCase: FreezedUnionCase.snake)

Constructors

InputRichBlock.anchor({@JsonKey.new(name: 'type') @Default.new(RichBlockType.anchor) RichBlockType type, @JsonKey.new(name: 'name') required String name})
A block with an anchor, corresponding to the HTML tag <a> with the attribute name.
const
factory
InputRichBlock.animation({@JsonKey.new(name: 'type') @Default.new(RichBlockType.animation) RichBlockType type, @JsonKey.new(name: 'animation') required InputMediaAnimation animation, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A block with an animation, corresponding to the HTML tag <video>.
const
factory
InputRichBlock.audio({@JsonKey.new(name: 'type') @Default.new(RichBlockType.audio) RichBlockType type, @JsonKey.new(name: 'audio') required InputMediaAudio audio, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A block with a music file, corresponding to the HTML tag <audio>.
const
factory
InputRichBlock.blockquote({@JsonKey.new(name: 'type') @Default.new(RichBlockType.blockquote) RichBlockType type, @JsonKey.new(name: 'blocks') required List<InputRichBlock> blocks, @JsonKey.new(name: 'credit') @RichTextConverter() RichText? credit})
A block quotation, corresponding to the HTML tag <blockquote>.
const
factory
InputRichBlock.collage({@JsonKey.new(name: 'type') @Default.new(RichBlockType.collage) RichBlockType type, @JsonKey.new(name: 'blocks') required List<InputRichBlock> blocks, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A collage, corresponding to the custom HTML tag <tg-collage>.
const
factory
InputRichBlock.details({@JsonKey.new(name: 'type') @Default.new(RichBlockType.details) RichBlockType type, @JsonKey.new(name: 'summary') @RichTextConverter() required RichText summary, @JsonKey.new(name: 'blocks') required List<InputRichBlock> blocks, @JsonKey.new(name: 'is_open') bool? isOpen})
An expandable block for details disclosure, corresponding to the HTML tag <details>.
const
factory
InputRichBlock.divider({@JsonKey.new(name: 'type') @Default.new(RichBlockType.divider) RichBlockType type})
A divider, corresponding to the HTML tag <hr/>.
const
factory
InputRichBlock.footer({@JsonKey.new(name: 'type') @Default.new(RichBlockType.footer) RichBlockType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A footer, corresponding to the HTML tag <footer>.
const
factory
InputRichBlock.fromJson(Map<String, dynamic> json)
Creates a InputRichBlock object from JSON.
factory
InputRichBlock.heading({@JsonKey.new(name: 'type') @Default.new(RichBlockType.heading) RichBlockType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'size') required int size})
A section heading, corresponding to the HTML tags <h1>, <h2>, <h3>, <h4>, <h5>, or <h6>.
const
factory
InputRichBlock.list({@JsonKey.new(name: 'type') @Default.new(RichBlockType.list) RichBlockType type, @JsonKey.new(name: 'items') required List<InputRichBlockListItem> items})
A list of blocks, corresponding to the HTML tag <ul> or <ol> with multiple nested tags <li>.
const
factory
InputRichBlock.map({@JsonKey.new(name: 'type') @Default.new(RichBlockType.map) RichBlockType type, @JsonKey.new(name: 'location') required Location location, @JsonKey.new(name: 'zoom') required int zoom, @JsonKey.new(name: 'width') required int width, @JsonKey.new(name: 'height') required int height, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A block with a map, corresponding to the custom HTML tag <tg-map>.
const
factory
InputRichBlock.mathematicalExpression({@JsonKey.new(name: 'type') @Default.new(RichBlockType.mathematicalExpression) RichBlockType type, @JsonKey.new(name: 'expression') required String expression})
A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag <tg-math-block>.
const
factory
InputRichBlock.paragraph({@JsonKey.new(name: 'type') @Default.new(RichBlockType.paragraph) RichBlockType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A text paragraph, corresponding to the HTML tag <p>.
const
factory
InputRichBlock.photo({@JsonKey.new(name: 'type') @Default.new(RichBlockType.photo) RichBlockType type, @JsonKey.new(name: 'photo') required InputMediaPhoto photo, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A block with a photo, corresponding to the HTML tag <img>.
const
factory
InputRichBlock.pre({@JsonKey.new(name: 'type') @Default.new(RichBlockType.pre) RichBlockType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'language') String? language})
A preformatted text block, corresponding to the nested HTML tags <pre> and <code>.
const
factory
InputRichBlock.pullquote({@JsonKey.new(name: 'type') @Default.new(RichBlockType.pullquote) RichBlockType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'credit') @RichTextConverter() RichText? credit})
A quotation with centered text, loosely corresponding to the HTML tag <aside>.
const
factory
InputRichBlock.slideshow({@JsonKey.new(name: 'type') @Default.new(RichBlockType.slideshow) RichBlockType type, @JsonKey.new(name: 'blocks') required List<InputRichBlock> blocks, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A slideshow, corresponding to the custom HTML tag <tg-slideshow>.
const
factory
InputRichBlock.table({@JsonKey.new(name: 'type') @Default.new(RichBlockType.table) RichBlockType type, @JsonKey.new(name: 'cells') required List<List<RichBlockTableCell>> cells, @JsonKey.new(name: 'is_bordered') bool? isBordered, @JsonKey.new(name: 'is_striped') bool? isStriped, @JsonKey.new(name: 'caption') @RichTextConverter() RichText? caption})
A table, corresponding to the HTML tag <table>.
const
factory
InputRichBlock.thinking({@JsonKey.new(name: 'type') @Default.new(RichBlockType.thinking) RichBlockType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A block with a “Thinking…” placeholder, corresponding to the custom HTML tag <tg-thinking>.
const
factory
InputRichBlock.video({@JsonKey.new(name: 'type') @Default.new(RichBlockType.video) RichBlockType type, @JsonKey.new(name: 'video') required InputMediaVideo video, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A block with a video, corresponding to the HTML tag <video>.
const
factory
InputRichBlock.voiceNote({@JsonKey.new(name: 'type') @Default.new(RichBlockType.voiceNote) RichBlockType type, @JsonKey.new(name: 'voice_note') required InputMediaVoiceNote voiceNote, @JsonKey.new(name: 'caption') RichBlockCaption? caption})
A block with a voice note, corresponding to the HTML tag <audio>.
const
factory

Properties

copyWith → $InputRichBlockCopyWith<InputRichBlock>
Create a copy of InputRichBlock with the given fields replaced by the non-null parameter values.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type RichBlockType
Type of the block, always "paragraph"
no setterinherited

Methods

getInputFiles() Iterable<InputFile?>
Returns an iterable of files
map<TResult extends Object?>({required TResult paragraph(InputRichBlockParagraph value), required TResult heading(InputRichBlockSectionHeading value), required TResult pre(InputRichBlockPreformatted value), required TResult footer(InputRichBlockFooter value), required TResult divider(InputRichBlockDivider value), required TResult mathematicalExpression(InputRichBlockMathematicalExpression value), required TResult anchor(InputRichBlockAnchor value), required TResult list(InputRichBlockList value), required TResult blockquote(InputRichBlockBlockQuotation value), required TResult pullquote(InputRichBlockPullQuotation value), required TResult collage(InputRichBlockCollage value), required TResult slideshow(InputRichBlockSlideshow value), required TResult table(InputRichBlockTable value), required TResult details(InputRichBlockDetails value), required TResult map(InputRichBlockMap value), required TResult animation(InputRichBlockAnimation value), required TResult audio(InputRichBlockAudio value), required TResult photo(InputRichBlockPhoto value), required TResult video(InputRichBlockVideo value), required TResult voiceNote(InputRichBlockVoiceNote value), required TResult thinking(InputRichBlockThinking value)}) → TResult

Available on InputRichBlock, provided by the InputRichBlockPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? paragraph(InputRichBlockParagraph value)?, TResult? heading(InputRichBlockSectionHeading value)?, TResult? pre(InputRichBlockPreformatted value)?, TResult? footer(InputRichBlockFooter value)?, TResult? divider(InputRichBlockDivider value)?, TResult? mathematicalExpression(InputRichBlockMathematicalExpression value)?, TResult? anchor(InputRichBlockAnchor value)?, TResult? list(InputRichBlockList value)?, TResult? blockquote(InputRichBlockBlockQuotation value)?, TResult? pullquote(InputRichBlockPullQuotation value)?, TResult? collage(InputRichBlockCollage value)?, TResult? slideshow(InputRichBlockSlideshow value)?, TResult? table(InputRichBlockTable value)?, TResult? details(InputRichBlockDetails value)?, TResult? map(InputRichBlockMap value)?, TResult? animation(InputRichBlockAnimation value)?, TResult? audio(InputRichBlockAudio value)?, TResult? photo(InputRichBlockPhoto value)?, TResult? video(InputRichBlockVideo value)?, TResult? voiceNote(InputRichBlockVoiceNote value)?, TResult? thinking(InputRichBlockThinking value)?}) → TResult?

Available on InputRichBlock, provided by the InputRichBlockPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult paragraph(InputRichBlockParagraph value)?, TResult heading(InputRichBlockSectionHeading value)?, TResult pre(InputRichBlockPreformatted value)?, TResult footer(InputRichBlockFooter value)?, TResult divider(InputRichBlockDivider value)?, TResult mathematicalExpression(InputRichBlockMathematicalExpression value)?, TResult anchor(InputRichBlockAnchor value)?, TResult list(InputRichBlockList value)?, TResult blockquote(InputRichBlockBlockQuotation value)?, TResult pullquote(InputRichBlockPullQuotation value)?, TResult collage(InputRichBlockCollage value)?, TResult slideshow(InputRichBlockSlideshow value)?, TResult table(InputRichBlockTable value)?, TResult details(InputRichBlockDetails value)?, TResult map(InputRichBlockMap value)?, TResult animation(InputRichBlockAnimation value)?, TResult audio(InputRichBlockAudio value)?, TResult photo(InputRichBlockPhoto value)?, TResult video(InputRichBlockVideo value)?, TResult voiceNote(InputRichBlockVoiceNote value)?, TResult thinking(InputRichBlockThinking value)?, required TResult orElse()}) → TResult

Available on InputRichBlock, provided by the InputRichBlockPatterns extension

A variant of map that fallback to returning orElse.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this InputRichBlock to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

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