Flutter Configuration
LovinaChatConfig
The LovinaChatConfig class holds all configuration options for the chat widget.
final config = LovinaChatConfig(
websiteToken: 'your-website-token',
baseUrl: 'https://chat.lovina.app',
locale: 'en',
colorScheme: 'auto',
user: null,
customColor: null,
displayMode: 'fullscreen',
);
Fields
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
websiteToken | String | -- | Yes | Your Lovina website channel token. Obtained from the Lovina dashboard. |
baseUrl | String | -- | Yes | Base URL of your Lovina instance (e.g., https://chat.lovina.app). |
locale | String | 'id' | No | Widget locale code. Supported values include 'id', 'en', 'ar'. |
colorScheme | String | 'auto' | No | Color scheme for the widget. Accepts 'light', 'dark', or 'auto' (follows system theme). |
user | LovinaChatUser? | null | No | Pre-identified user to associate with the conversation. See below. |
customColor | String? | null | No | Hex color string for header and bubble theming (e.g., '#FF6B35'). |
displayMode | String | 'fullscreen' | No | Widget display mode. Accepts 'popup', 'sidebar', or 'fullscreen'. |
LovinaChatUser
The LovinaChatUser class represents a pre-identified user.
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | String | Yes | Unique user ID in your system. |
name | String? | No | Display name. |
email | String? | No | Email address. |
avatarUrl | String? | No | Avatar image URL. |
identifierHash | String? | No | HMAC hash for identity verification. Generate server-side. |
phoneNumber | String? | No | Phone number (E.164 format recommended). |
customAttributes | Map<String, dynamic>? | No | Arbitrary key-value metadata attached to the contact. |
Event Types
All events extend the ChatEvent base class.
| Event Class | Properties | Description |
|---|---|---|
ChatLoadedEvent | authToken (String?) | Widget finished loading. |
MessageReceivedEvent | message (Map<String, dynamic>) | New message received. |
UnreadCountChangedEvent | count (int) | Unread count changed. |
ChatClosedEvent | reason (String?) | Chat was closed. |
ChatErrorEvent | code (String), message (String) | An error occurred. |
Example: Full Configuration
import 'package:lovina_chat_sdk/lovina_chat_sdk.dart';
final config = LovinaChatConfig(
websiteToken: 'ws-tok-abc123',
baseUrl: 'https://chat.lovina.app',
locale: 'en',
colorScheme: 'dark',
displayMode: 'fullscreen',
customColor: '#6366F1',
user: LovinaChatUser(
identifier: 'user-12345',
name: 'Jane Doe',
email: 'jane@example.com',
avatarUrl: 'https://example.com/avatar.png',
identifierHash: 'hmac-sha256-hash',
phoneNumber: '+6281234567890',
customAttributes: {
'plan': 'premium',
'signup_date': '2025-01-15',
},
),
);