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.
constfactory
- RichText.anchorLink({@JsonKey.new(name: 'type') @Default.new(RichTextType.anchorLink) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'anchor_name') required String anchorName})
-
A link to an anchor.
constfactory
- 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.
constfactory
- RichText.bold({@JsonKey.new(name: 'type') @Default.new(RichTextType.bold) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
A bold text.
constfactory
- 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.
constfactory
- 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.
constfactory
- RichText.code({@JsonKey.new(name: 'type') @Default.new(RichTextType.code) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
A monowidth text.
constfactory
-
RichText.collection({@JsonKey.new(name: 'type') @Default.new(RichTextType.collection) RichTextType type, required List<
RichText> texts}) -
Internal factory for collection array representation
constfactory
- 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.
constfactory
- 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.
constfactory
- 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.
constfactory
-
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.
constfactory
- RichText.italic({@JsonKey.new(name: 'type') @Default.new(RichTextType.italic) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
An italicized text.
constfactory
- RichText.marked({@JsonKey.new(name: 'type') @Default.new(RichTextType.marked) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
A marked text.
constfactory
- RichText.mathematicalExpression({@JsonKey.new(name: 'type') @Default.new(RichTextType.mathematicalExpression) RichTextType type, @JsonKey.new(name: 'expression') required String expression})
-
A mathematical expression.
constfactory
- 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.
constfactory
- 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.
constfactory
- RichText.plain({@JsonKey.new(name: 'type') @Default.new(RichTextType.plain) RichTextType type, required String text})
-
Internal factory for plain text string representation
constfactory
- 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.
constfactory
- RichText.referenceLink({@JsonKey.new(name: 'type') @Default.new(RichTextType.referenceLink) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text, @JsonKey.new(name: 'reference_name') required String referenceName})
-
A link to a reference.
constfactory
- 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.
constfactory
- RichText.strikethrough({@JsonKey.new(name: 'type') @Default.new(RichTextType.strikethrough) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
A strikethrough text.
constfactory
- RichText.subscript({@JsonKey.new(name: 'type') @Default.new(RichTextType.subscript) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
A subscript text.
constfactory
- RichText.superscript({@JsonKey.new(name: 'type') @Default.new(RichTextType.superscript) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
A superscript text.
constfactory
- 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.
constfactory
- RichText.underline({@JsonKey.new(name: 'type') @Default.new(RichTextType.underline) RichTextType type, @JsonKey.new(name: 'text') @RichTextConverter() required RichText text})
-
An underlined text.
constfactory
- 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.
constfactory
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
Aswitch-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 ofmapthat fallback to returningnull. -
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 ofmapthat fallback to returningorElse. -
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