copyWith method
- 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,
Copies with some fields replaced; clear* flags null a field.
Implementation
ChatState 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(
phase: phase ?? this.phase,
connection: connection ?? this.connection,
config: config ?? this.config,
visitor: visitor ?? this.visitor,
conversation: clearConversation ? null : (conversation ?? this.conversation),
timeline: timeline ?? this.timeline,
pending: pending ?? this.pending,
typingAgent: clearTyping ? null : (typingAgent ?? this.typingAgent),
availability: availability ?? this.availability,
unread: unread ?? this.unread,
locale: locale ?? this.locale,
needsEmail: needsEmail ?? this.needsEmail,
skippedEmail: skippedEmail ?? this.skippedEmail,
rated: clearRated ? null : (rated ?? this.rated),
transientError: clearError ? null : (transientError ?? this.transientError),
outdatedReason: outdatedReason ?? this.outdatedReason,
visitorEmail: visitorEmail ?? this.visitorEmail,
visitorName: visitorName ?? this.visitorName,
loadingEarlier: loadingEarlier ?? this.loadingEarlier,
visible: visible ?? this.visible,
foreground: foreground ?? this.foreground,
draft: clearDraft ? null : (draft ?? this.draft),
);