User class abstract
This object represents a Telegram user or bot.
- Implemented types
- Available extensions
- Annotations
-
- @freezed
Constructors
- User.new({@JsonKey(name: 'id') required int id, @JsonKey(name: 'is_bot') required bool isBot, @JsonKey(name: 'first_name') required String firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'username') String? username, @JsonKey(name: 'language_code') String? languageCode, @JsonKey(name: 'is_premium') bool? isPremium, @JsonKey(name: 'added_to_attachment_menu') bool? addedToAttachmentMenu, @JsonKey(name: 'can_join_groups') bool? canJoinGroups, @JsonKey(name: 'can_read_all_group_messages') bool? canReadAllGroupMessages, @JsonKey(name: 'supports_inline_queries') bool? supportsInlineQueries, @JsonKey(name: 'can_connect_to_business') bool? canConnectToBusiness, @JsonKey(name: 'has_main_web_app') bool? hasMainWebApp})
-
Creates a Telegram user or bot
constfactory
-
User.fromJson(Map<
String, dynamic> json) -
Creates a User from a JSON map
factory
Properties
- addedToAttachmentMenu → bool?
-
Optional. True, if this user added the bot to the attachment menu
no setterinherited
- canConnectToBusiness → bool?
-
Optional. True, if the bot can be connected to a Telegram Business
account to receive its messages. Returned only in getMe.
no setterinherited
- canJoinGroups → bool?
-
Optional. True, if the bot can be invited to groups. Returned only in
getMe.
no setterinherited
- canReadAllGroupMessages → bool?
-
Optional. True, if privacy mode is disabled for the bot. Returned only
in getMe.
no setterinherited
-
copyWith
→ $UserCopyWith<
User> -
Create a copy of User
with the given fields replaced by the non-null parameter values.
no setterinherited
- firstName → String
-
User's or bot's first name
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasMainWebApp → bool?
-
Optional. True, if the bot has a main Web App. Returned only in getMe.
no setterinherited
- id → int
-
Unique identifier for this user or bot. This number may have more than
32 significant bits and some programming languages may have
difficulty/silent defects in interpreting it. But it has at most 52
significant bits, so a 64-bit integer or double-precision float type are
safe for storing this identifier.
no setterinherited
- isBot → bool
-
True, if this user is a bot
no setterinherited
- isPremium → bool?
-
Optional. True, if this user is a Telegram Premium user
no setterinherited
- languageCode → String?
-
Optional. IETF language tag of the user's language
no setterinherited
- lastName → String?
-
Optional. User's or bot's last name
no setterinherited
- mention → UserMention
-
Available on User, provided by the Mention extension
Example: When you want to mention a user in a message, you can use this extension to represent the mention instead of manually creating the mention URL.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsInlineQueries → bool?
-
Optional. True, if the bot supports inline queries. Returned only in
getMe.
no setterinherited
- username → String?
-
Optional. User's or bot's username
no setterinherited
Methods
-
getChannelId(
) → ID? -
Available on User, provided by the GetUserChatID extension
Gets the chat'sChannelID
from the username -
getId(
) → ChatID -
Available on User, provided by the GetUserChatID extension
Returns theChatID
of the chat. -
isTheSameChat(
ID chatId) → bool -
Available on User, provided by the GetUserChatID extension
Returns true if thechatId
passed matches the current chat's ID. -
mentionWith(
String text, {ParseMode parseMode = ParseMode.html}) → UserMention -
Available on User, provided by the Mention extension
Returns a UserMention object with the passedtext
andparseMode
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this User to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited