HatangChatController class
A ChangeNotifier over the engine for widgets: exposes state and the composer actions. One controller per visible conversation view.
- Inheritance
-
- Object
- ChangeNotifier
- HatangChatController
Constructors
- HatangChatController(ChatEngine engine, {HatangAttachmentPicker? picker})
-
Creates a controller over
engine.
Properties
- canPickFile → bool
-
The composer may offer "File" (a file picker was provided).
no setter
- engine → ChatEngine
-
The engine.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → ChatState
-
Current snapshot.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
attach(
UploadSource source, {String caption = ''}) → Future< void> - Sends a file you already have (bytes, name, MIME type).
-
cancelEmailForm(
) → void - Dismisses the pre-chat form.
-
clearError(
) → void - Clears the error banner.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
listConversations(
{String status = 'all', String? after, int limit = 20}) → Future< ConversationPage> -
The visitor's conversations (see
ChatEngine.listConversations). -
loadEarlier(
) → Future< void> - Loads the previous page of history.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onTextChanged(
String text) → void - The composer text changed (typing indicator).
-
openActive(
) → Future< void> - Back to the current open conversation (or an empty chat).
-
openConversation(
String id, {VisitorConversationDto? summary}) → Future< void> -
Shows conversation
id. -
pickAndSend(
HatangAttachmentSource source) → Future< bool> -
Lets the visitor pick from
source(camera, photo library, files) and sends the result. Returns false when they cancelled. -
pickAndSendFile(
) → Future< bool> - Picks any file and sends it.
-
pickAndSendImage(
{bool camera = false}) → Future< bool> - Picks a photo from the library (or the camera) and sends it.
-
quickReply(
String label) → Future< void> - A quick reply was tapped: sends its label. (Cards render in 0.2.0.)
-
rate(
int score, {String? comment}) → void - Rates the conversation (CSAT card; rendering arrives in 0.2.0).
-
reconnect(
) → Future< void> - Reconnects after a background close or a failed bootstrap.
-
refreshAttachments(
MessageDto message) → Future< void> -
An attachment link of
messageexpired: fetch fresh ones. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resolvePaymentQr(
PaymentCard card) → Future< PaymentQrSource> - Where to draw a payment card's VietQR code from.
-
retry(
String clientId) → Future< void> - Re-sends a failed message.
-
send(
String text) → Future< void> -
Sends
text. -
setVisible(
bool visible) → void - The conversation is (not) on screen.
-
skipEmail(
) → Future< void> - The optional email was skipped.
-
submitEmail(
String email) → Future< void> - Inline email request answered.
-
submitOfflineForm(
{String? name, String? email, String? message}) → Future< void> - Offline pre-chat form submitted.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited