Chat class abstract

This object represents a chat.

Implemented types
Available extensions
Annotations
  • @freezed

Constructors

Chat({@JsonKey.new(name: 'id') required int id, @JsonKey.new(name: 'type') required ChatType type, @JsonKey.new(name: 'title') String? title, @JsonKey.new(name: 'username') String? username, @JsonKey.new(name: 'first_name') String? firstName, @JsonKey.new(name: 'last_name') String? lastName, @JsonKey.new(name: 'is_forum') bool? isForum, @JsonKey.new(name: 'is_direct_messages') bool? isDirectMessages})
Constructs a Chat object.
const
factory
Chat.fromJson(Map<String, dynamic> json)
Creates a Chat object from JSON.
factory

Properties

copyWith → $ChatCopyWith<Chat>
Create a copy of Chat with the given fields replaced by the non-null parameter values.
no setterinherited
firstName → String?
First name of the other party in a private chat.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
id → int
Unique identifier for this chat.
no setterinherited
isDirectMessages → bool?
Optional. True, if the chat is the direct messages chat of a channel
no setterinherited
isForum → bool?
True, if the supergroup chat is a forum (has topics enabled).
no setterinherited
lastName → String?
Last name of the other party in a private chat.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
title → String?
Title, for supergroups, channels, and group chats.
no setterinherited
type → ChatType
Type of the chat, can be either "private", "group", "supergroup" or "channel".
no setterinherited
username → String?
Username, for private chats, supergroups, and channels if available.
no setterinherited

Methods

getChannelId() → ID?

Available on Chat, provided by the GetChatID extension

Gets the chat's ChannelID from the username
getId() → ChatID

Available on Chat, provided by the GetChatID extension

Returns the ChatID of the chat.
isTheSameChat(ID chatId) → bool

Available on Chat, provided by the GetChatID extension

Returns true if the chatId passed matches the current chat's ID.
map<TResult extends Object?>(TResult $default(_Chat value)) → TResult

Available on Chat, provided by the ChatPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_Chat value)?) → TResult?

Available on Chat, provided by the ChatPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_Chat value)?, {required TResult orElse()}) → TResult

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

Operators

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