SupportClient class

Inheritance

Constructors

SupportClient({required String appKey, required String serverUrl, ShotikTransport? transport, ShotikStorage? storage, Future<Map<String, Object?>> device()?, String platform = 'ios', Random? random, int now()?})

Properties

anonymousId → String?
no setter
appKey → String
final
device → Future<Map<String, Object?>> Function()?
The identify device object (support naming) and its locale; see ShotikDevice.support.
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
lastReconnectDelay → Duration?
no setter
pendingCount → int
no setter
platform → String
Default platform for setPushToken.
final
reconnectAttempts → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverUrl → String
final
state → SupportState
no setter
storage → ShotikStorage
final
transport → ShotikTransport
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
close() → void
disconnect() → void
Drop the live socket without stopping (the app going to the background, tests).
dispose() → void
Discards any resources used by the object.
inherited
ensureIdentified() → Future<void>
Identify anonymously unless the app already did.
flush() → Future<void>
Deliver queued messages in order. Network errors, 5xx and 429 keep them queued as waiting with backoff; another 4xx fails the message; a 401 drops the session and identifies again.
foreground() → void
App came back to the foreground: reconnect now, deliver the queue and fetch what was missed.
handoff(String conversationId) → Future<void>
"Talk to a person": the conversation goes to the founder's Needs-human list and the AI stops answering it.
identify([UserInfo user = const UserInfo()]) → Future<void>
Identify the app user. Without a userId the persisted anonymous id is used; with one, the anonymous user's conversations move to the signed-in user on the server. Never throws: failures land in state.status/error.
loadMessages(String conversationId) → Future<List<Message>>
markRead(String conversationId) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
open([String? conversationId]) → void
Show the sheet; with an id, on that thread.
pull() → Future<void>
Catch up after a reconnect or when the app comes to the foreground.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
request(String method, String path, {Object? json, _Multipart? form}) → Future<Map<String, Object?>>
reset() → Future<void>
Sign-out: forget the identified user and start over as a new anonymous user.
retry(String localMessageId) → void
Retry a failed message now.
select(String? conversationId) → void
Show one thread (or the list with null), load its messages and mark it read.
send(String body, {String? conversationId, List<LocalAttachment> attachments = const []}) → Message?
Send a message. Without a conversation id (or with a local one) a new conversation is started. The message shows at once; the queue delivers it now or once the server is reachable again.
setPushToken(String? token, [String? platform]) → Future<void>
stop() → void
toString() → String
A string representation of this object.
inherited
url(String path) → String
A server path (attachment) as a full URL.

Operators

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