CrispController class

The controller to manage the chat

Constructors

CrispController({required String websiteId, String locale = 'en', String? userToken, CrispUser? user, void onSessionIdReceived(String sessionId)?})

Properties

commands Queue
Commands which are defined on register and executed on CrispView initState
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
locale String
Locale to define which language the chat should appear
getter/setter pair
onSessionIdReceived ↔ (void Function(String sessionId)?)
A callback that is invoked when the session id is received.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
user CrispUser?
The chat user model with possible additional data
getter/setter pair
userToken String?
The token of the user
getter/setter pair
websiteId String
The id of your crisp chat
final
webViewController ↔ InAppWebViewController?
The web view controller
getter/setter pair

Methods

appendScript(String script) → void
Append a script to the queue This is useful to append a script to the queue and execute it on CrispView initState
getSessionId() Future<String>
Get the session id This is useful to track the user's session. The session id is a unique identifier for the user's session. The session id is received in the onSessionIdReceived callback. If the session id is not received, it will try to get the session id again. If the session id is not found, it will return 'Session ID not found'. If the session id is found, it will return the session id. If the session id is found and the onSessionIdReceived callback is not null, it will invoke the onSessionIdReceived callback.
logout() → dynamic
Logout the user from the chat This is useful to logout the user from the chat. It will reset the user's session. It will also clear the user's data. It will also clear the user's segments. It will also clear the user's session data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register({required CrispUser user}) → void
Register a new user to start the chat This is useful to register a new user to start the chat.
setMessage(String text) → dynamic
Set Initial Message This is useful to set the initial message.
setSegments(List<String> segments) → dynamic
setSessionData(Map<String, String> sessionData) → dynamic
Set the session data This is useful to set the session data. It will set the session data for the user's session. It will also set the session data for the user's session.
toString() String
A string representation of this object.
inherited

Operators

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