ChatState class
Immutable snapshot of everything the UI renders.
- Annotations
Constructors
-
ChatState({ChatPhase phase = ChatPhase.idle, HatangConnectionState connection = HatangConnectionState.disconnected, SiteConfig? config, VisitorDto? visitor, ConversationSummary? conversation, Timeline timeline = Timeline.empty, List<
PendingMessage> pending = const [], String? typingAgent, Availability availability = Availability.offline, int unread = 0, HatangLocale locale = HatangLocale.vi, bool needsEmail = false, bool skippedEmail = false, int? rated, HatangException? transientError, String? outdatedReason, String? visitorEmail, String? visitorName, bool loadingEarlier = false, bool visible = false, bool foreground = true, String? draft}) -
Creates a state.
const
Properties
- availability → Availability
-
Team availability.
final
- canRead → bool
-
visible && foreground: incoming messages count as read.no setter - config → SiteConfig?
-
Site settings (after bootstrap).
final
- connection → HatangConnectionState
-
Socket state.
final
- conversation → ConversationSummary?
-
The active conversation.
final
- draft → String?
-
Text held back by the pre-chat form; sent once it is answered.
final
- foreground → bool
-
The app is in the foreground.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- loadingEarlier → bool
-
An earlier page is loading.
final
- locale → HatangLocale
-
Locale in use.
final
- needsEmail → bool
-
Show the pre-chat (offline) form before sending.
final
- online → bool
-
The site is online (someone or the bot can reply).
no setter
- outdatedReason → String?
-
Why the gateway wants a newer SDK.
final
-
pending
→ List<
PendingMessage> -
Outgoing messages without an ack.
final
- phase → ChatPhase
-
Life-cycle phase.
final
- rated → int?
-
Score the visitor gave (from a
ratedevent orrate).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → HatangSession
-
Host-facing session view.
no setter
- skippedEmail → bool
-
The visitor skipped the optional email form this session.
final
- timeline → Timeline
-
Loaded items.
final
- transientError → HatangException?
-
Last error worth a banner (cleared by the UI).
final
- typingAgent → String?
-
Name of the agent typing (empty string when unnamed);
nullwhen nobody is.final - unread → int
-
Messages received while the screen was not visible.
final
- visible → bool
-
The conversation is on screen.
final
- visitor → VisitorDto?
-
The visitor (after bootstrap).
final
- visitorEmail → String?
-
Email known for the visitor (from bootstrap, identify or forms).
final
- visitorName → String?
-
Name known for the visitor.
final
Methods
-
copyWith(
{ChatPhase? phase, HatangConnectionState? connection, SiteConfig? config, VisitorDto? visitor, ConversationSummary? conversation, Timeline? timeline, List< PendingMessage> ? pending, String? typingAgent, Availability? availability, int? unread, HatangLocale? locale, bool? needsEmail, bool? skippedEmail, int? rated, HatangException? transientError, String? outdatedReason, String? visitorEmail, String? visitorName, bool? loadingEarlier, bool? visible, bool? foreground, String? draft, bool clearConversation = false, bool clearTyping = false, bool clearError = false, bool clearDraft = false, bool clearRated = false}) → ChatState -
Copies with some fields replaced;
clear*flags null a field. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited