RichText class sealed

This object represents a rich formatted text.

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

Constructors

RichText.anchor({@JsonKey.new(name: 'type') @Default.new(RichTextType.anchor) RichTextType type, @JsonKey.new(name: 'name') required String name})
An anchor.
const
factory
A link to an anchor.
const
factory
RichText.bankCardNumber({@JsonKey.new(name: 'type') @Default.new(RichTextType.bankCardNumber) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'bank_card_number') required String bankCardNumber})
A text with a bank card number.
const
factory
RichText.bold({@JsonKey.new(name: 'type') @Default.new(RichTextType.bold) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A bold text.
const
factory
RichText.botCommand({@JsonKey.new(name: 'type') @Default.new(RichTextType.botCommand) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'bot_command') required String botCommand})
A bot command.
const
factory
RichText.cashtag({@JsonKey.new(name: 'type') @Default.new(RichTextType.cashtag) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'cashtag') required String cashtag})
A cashtag.
const
factory
RichText.code({@JsonKey.new(name: 'type') @Default.new(RichTextType.code) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A monowidth text.
const
factory
RichText.collection({@JsonKey.new(name: 'type') @Default.new(RichTextType.collection) RichTextType type, required List<RichText> texts})
Internal factory for collection array representation
const
factory
RichText.customEmoji({@JsonKey.new(name: 'type') @Default.new(RichTextType.customEmoji) RichTextType type, @JsonKey.new(name: 'custom_emoji_id') required String customEmojiId, @JsonKey.new(name: 'alternative_text') required String alternativeText})
A custom emoji.
const
factory
RichText.dateTime({@JsonKey.new(name: 'type') @Default.new(RichTextType.dateTime) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'unix_time') required int unixTime, @JsonKey.new(name: 'date_time_format') required String dateTimeFormat})
Formatted date and time.
const
factory
RichText.emailAddress({@JsonKey.new(name: 'type') @Default.new(RichTextType.emailAddress) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'email_address') required String emailAddress})
A text with an email address.
const
factory
RichText.fromJson(Map<String, dynamic> json)
Creates a RichText object from JSON.
factory
RichText.hashtag({@JsonKey.new(name: 'type') @Default.new(RichTextType.hashtag) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'hashtag') required String hashtag})
A hashtag.
const
factory
RichText.italic({@JsonKey.new(name: 'type') @Default.new(RichTextType.italic) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
An italicized text.
const
factory
RichText.marked({@JsonKey.new(name: 'type') @Default.new(RichTextType.marked) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A marked text.
const
factory
RichText.mathematicalExpression({@JsonKey.new(name: 'type') @Default.new(RichTextType.mathematicalExpression) RichTextType type, @JsonKey.new(name: 'expression') required String expression})
A mathematical expression.
const
factory
RichText.mention({@JsonKey.new(name: 'type') @Default.new(RichTextType.mention) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'username') required String username})
A mention by a username.
const
factory
RichText.phoneNumber({@JsonKey.new(name: 'type') @Default.new(RichTextType.phoneNumber) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'phone_number') required String phoneNumber})
A text with a phone number.
const
factory
RichText.plain({@JsonKey.new(name: 'type') @Default.new(RichTextType.plain) RichTextType type, required String text})
Internal factory for plain text string representation
const
factory
RichText.reference({@JsonKey.new(name: 'type') @Default.new(RichTextType.reference) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'name') required String name})
A reference.
const
factory
A link to a reference.
const
factory
RichText.spoiler({@JsonKey.new(name: 'type') @Default.new(RichTextType.spoiler) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A text covered by a spoiler.
const
factory
RichText.strikethrough({@JsonKey.new(name: 'type') @Default.new(RichTextType.strikethrough) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A strikethrough text.
const
factory
RichText.subscript({@JsonKey.new(name: 'type') @Default.new(RichTextType.subscript) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A subscript text.
const
factory
RichText.superscript({@JsonKey.new(name: 'type') @Default.new(RichTextType.superscript) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
A superscript text.
const
factory
RichText.textMention({@JsonKey.new(name: 'type') @Default.new(RichTextType.textMention) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'user') required User user})
A mention of a Telegram user by their identifier.
const
factory
RichText.underline({@JsonKey.new(name: 'type') @Default.new(RichTextType.underline) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
An underlined text.
const
factory
RichText.url({@JsonKey.new(name: 'type') @Default.new(RichTextType.url) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'url') required String url})
A text with a link.
const
factory

Properties

copyWith → $RichTextCopyWith<RichText>
Create a copy of RichText 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 RichTextType
Type of the rich text, always "bold"
no setterinherited

Methods

map<TResult extends Object?>({required TResult plain(RichTextPlain value), required TResult collection(RichTextCollection value), required TResult bold(RichTextBold value), required TResult italic(RichTextItalic value), required TResult underline(RichTextUnderline value), required TResult strikethrough(RichTextStrikethrough value), required TResult spoiler(RichTextSpoiler value), required TResult dateTime(RichTextDateTime value), required TResult textMention(RichTextTextMention value), required TResult subscript(RichTextSubscript value), required TResult superscript(RichTextSuperscript value), required TResult marked(RichTextMarked value), required TResult code(RichTextCode value), required TResult customEmoji(RichTextCustomEmoji value), required TResult mathematicalExpression(RichTextMathematicalExpression value), required TResult url(RichTextUrl value), required TResult emailAddress(RichTextEmailAddress value), required TResult phoneNumber(RichTextPhoneNumber value), required TResult bankCardNumber(RichTextBankCardNumber value), required TResult mention(RichTextMention value), required TResult hashtag(RichTextHashtag value), required TResult cashtag(RichTextCashtag value), required TResult botCommand(RichTextBotCommand value), required TResult anchor(RichTextAnchor value), required TResult anchorLink(RichTextAnchorLink value), required TResult reference(RichTextReference value), required TResult referenceLink(RichTextReferenceLink value)}) → TResult

Available on RichText, provided by the RichTextPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? plain(RichTextPlain value)?, TResult? collection(RichTextCollection value)?, TResult? bold(RichTextBold value)?, TResult? italic(RichTextItalic value)?, TResult? underline(RichTextUnderline value)?, TResult? strikethrough(RichTextStrikethrough value)?, TResult? spoiler(RichTextSpoiler value)?, TResult? dateTime(RichTextDateTime value)?, TResult? textMention(RichTextTextMention value)?, TResult? subscript(RichTextSubscript value)?, TResult? superscript(RichTextSuperscript value)?, TResult? marked(RichTextMarked value)?, TResult? code(RichTextCode value)?, TResult? customEmoji(RichTextCustomEmoji value)?, TResult? mathematicalExpression(RichTextMathematicalExpression value)?, TResult? url(RichTextUrl value)?, TResult? emailAddress(RichTextEmailAddress value)?, TResult? phoneNumber(RichTextPhoneNumber value)?, TResult? bankCardNumber(RichTextBankCardNumber value)?, TResult? mention(RichTextMention value)?, TResult? hashtag(RichTextHashtag value)?, TResult? cashtag(RichTextCashtag value)?, TResult? botCommand(RichTextBotCommand value)?, TResult? anchor(RichTextAnchor value)?, TResult? anchorLink(RichTextAnchorLink value)?, TResult? reference(RichTextReference value)?, TResult? referenceLink(RichTextReferenceLink value)?}) → TResult?

Available on RichText, provided by the RichTextPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult plain(RichTextPlain value)?, TResult collection(RichTextCollection value)?, TResult bold(RichTextBold value)?, TResult italic(RichTextItalic value)?, TResult underline(RichTextUnderline value)?, TResult strikethrough(RichTextStrikethrough value)?, TResult spoiler(RichTextSpoiler value)?, TResult dateTime(RichTextDateTime value)?, TResult textMention(RichTextTextMention value)?, TResult subscript(RichTextSubscript value)?, TResult superscript(RichTextSuperscript value)?, TResult marked(RichTextMarked value)?, TResult code(RichTextCode value)?, TResult customEmoji(RichTextCustomEmoji value)?, TResult mathematicalExpression(RichTextMathematicalExpression value)?, TResult url(RichTextUrl value)?, TResult emailAddress(RichTextEmailAddress value)?, TResult phoneNumber(RichTextPhoneNumber value)?, TResult bankCardNumber(RichTextBankCardNumber value)?, TResult mention(RichTextMention value)?, TResult hashtag(RichTextHashtag value)?, TResult cashtag(RichTextCashtag value)?, TResult botCommand(RichTextBotCommand value)?, TResult anchor(RichTextAnchor value)?, TResult anchorLink(RichTextAnchorLink value)?, TResult reference(RichTextReference value)?, TResult referenceLink(RichTextReferenceLink value)?, required TResult orElse()}) → TResult

Available on RichText, provided by the RichTextPatterns 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 RichText to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

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