Flutter Configuration
LovinaChatConfig
The LovinaChatConfig class holds all configuration options for the chat widget.
final config = LovinaChatConfig(
websiteToken: 'your-website-token',
baseUrl: 'https://chat.ailovina.com',
locale: 'en',
colorScheme: 'auto',
user: null,
theme: null,
branding: null,
texts: null,
features: null,
displayMode: 'fullscreen',
);
Fields
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
websiteToken | String | -- | Yes | Your Lovina website token for this agent. Obtained from the Lovina dashboard -- each agent has its own token. |
baseUrl | String | -- | Yes | Base URL of your Lovina instance (e.g., https://chat.ailovina.com). |
locale | String | 'id' | No | Widget locale code. Supported values include 'id', 'en', 'ar'. |
colorScheme | String | 'auto' | No | Dark mode preference 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. |
identity | LovinaChatIdentity? | null | No | Signed identity proof (HMAC) verifying the session's user. See Identity Verification. |
theme | LovinaThemeConfig? | null | No | Theme color, typography, and sizing overrides. Only primaryColor is required in practice -- see Theming. |
branding | LovinaBrandingConfig? | null | No | White-label branding overrides (logo, brand name, "powered by" footer). |
texts | Map<String, dynamic>? | null | No | UI string overrides, keyed by translation key. |
features | LovinaFeatureFlags? | null | No | Feature-flag overrides. See File Uploads. |
displayMode | String | 'fullscreen' | No | Widget display mode. Accepts 'popup', 'sidebar', or 'fullscreen'. |
hideKeyboardAccessoryBar | bool | true | No | Suppress WebKit's keyboard form-assistant bar on iOS while the chat widget is visible. See iOS Keyboard Accessory Bar below. |
Theming
Only LovinaThemeConfig.primaryColor is required in practice -- every other color is auto-generated by the widget to meet WCAG AA contrast:
LovinaChatConfig(
websiteToken: 'your-website-token',
baseUrl: 'https://chat.ailovina.com',
theme: LovinaThemeConfig(
primaryColor: '#6366F1',
fontFamily: 'Inter, sans-serif',
bubbleRadius: 16,
),
branding: LovinaBrandingConfig(
brandName: 'Acme Support',
poweredBy: false,
),
);
Identity Verification (optional)
identity proves a session belongs to a specific user with a server-signed HMAC:
final config = LovinaChatConfig(
websiteToken: 'YOUR_TOKEN',
baseUrl: 'https://chat.ailovina.com',
identity: LovinaChatIdentity(
userId: 'user-123',
exp: 1735689600,
sigHash: 'server-computed-hmac-hash',
),
);
| Option | Type | Description |
|---|---|---|
mode | String | Identity mode. Always 'user' (the default). |
userId | String | The same user ID you pass as identifier in LovinaChatUser. |
exp | int | Unix timestamp (seconds) after which sigHash expires. |
sigHash | String | HMAC signature computed on your server -- never in the app. |
See the User Identification guide for how to compute sigHash.
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. |
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. |
iOS Keyboard Accessory Bar
hideKeyboardAccessoryBar (default true) suppresses WebKit's keyboard form-assistant bar
(Previous/Next/Done) while the chat widget's WebView has focus.
Note: this suppresses the accessory bar for any WebView in your app while the chat is
mounted, not just the chat's own. If your app has other WebViews (e.g. an in-app browser), set
hideKeyboardAccessoryBar: false to avoid affecting them.
File Uploads
File uploads are disabled by default. Enable the composer's attach button with:
LovinaChatConfig(
websiteToken: 'your-website-token',
baseUrl: 'https://chat.ailovina.com',
features: LovinaFeatureFlags(enableFileUpload: true),
)
Do a clean rebuild (flutter clean) after upgrading the SDK so the change takes effect.
On iOS, users can also tap "Take Photo or Video" from the file picker. Your app's
ios/Runner/Info.plist must declare NSCameraUsageDescription and
NSMicrophoneUsageDescription before enabling this — without them, tapping that option crashes
the app.
Example: Full Configuration
import 'package:lovina_chat_sdk/lovina_chat_sdk.dart';
final config = LovinaChatConfig(
websiteToken: 'lvk_live_xxxx',
baseUrl: 'https://chat.ailovina.com',
locale: 'en',
colorScheme: 'dark',
displayMode: 'fullscreen',
theme: LovinaThemeConfig(
primaryColor: '#6366F1',
),
branding: LovinaBrandingConfig(
brandName: 'Acme Support',
),
identity: LovinaChatIdentity(
userId: 'user-12345',
exp: 1735689600,
sigHash: 'server-computed-hmac-hash',
),
user: LovinaChatUser(
identifier: 'user-12345',
name: 'Jane Doe',
email: 'jane@example.com',
avatarUrl: 'https://example.com/avatar.png',
phoneNumber: '+6281234567890',
customAttributes: {
'plan': 'premium',
'signup_date': '2025-01-15',
},
),
);