ChatConfig class

Configures the behavior of the chat plugin

Constructors

ChatConfig.new({required String apiUrl, bool enableTypingIndicators = true, bool enableReadReceipts = true, bool enableOnlineStatus = true, bool autoMarkAsRead = true, int connectionTimeout = 10, int maxReconnectionAttempts = 5, int chatRoomRefreshInterval = 30, String? userId, String? token, Map<String, String>? additionalHeaders, Map<String, dynamic>? socketParams, bool debugMode = false, Future<String> fileUploadHandler(String filePath)?})
Constructor

Properties

additionalHeaders Map<String, String>?
Additional headers to include in API requests
final
apiUrl String
The base URL of the chat API
final
autoMarkAsRead bool
Whether to automatically mark messages as read when received
final
chatRoomRefreshInterval int
How often to automatically refresh the chat room list (in seconds)
final
connectionTimeout int
Socket connection timeout in seconds
final
debugMode bool
Debug mode for logging
getter/setter pair
enableOnlineStatus bool
Whether to show online status
final
enableReadReceipts bool
Whether to show read receipts
final
enableTypingIndicators bool
Whether to show typing indicators
final
fileUploadHandler Future<String> Function(String filePath)?
File upload handler function Takes a local file path and returns a URL to the uploaded file
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
maxReconnectionAttempts int
Maximum number of retry attempts for socket connection
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socketParams Map<String, dynamic>?
Custom parameters for socket connection
final
token String?
Authentication token (can be null if not authenticated)
final
userId String?
User ID for the current user (can be null if not authenticated)
final

Methods

clearCredentials() ChatConfig
Clear user credentials
copyWith({String? apiUrl, bool? enableTypingIndicators, bool? enableReadReceipts, bool? enableOnlineStatus, bool? autoMarkAsRead, int? connectionTimeout, int? maxReconnectionAttempts, int? chatRoomRefreshInterval, String? userId, String? token, Map<String, String>? additionalHeaders, Map<String, dynamic>? socketParams, bool? debugMode, Future<String> fileUploadHandler(String filePath)?}) ChatConfig
Create a copy of this config with some values changed
getRequestHeaders() Map<String, String>
Get request headers for API calls
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateCredentials({required String userId, required String token}) ChatConfig
Update the user credentials

Operators

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

Static Properties

instance ChatConfig
Singleton instance
getter/setter pair