osvi_chat, on pub.dev) puts one of your chat agents in a Flutter app. It talks to the same agent, dashboard settings and conversations as the website chat, and gives you a ready-made chat screen, a launcher button, and a headless client if you want your own interface.
It runs on iOS, Android, web, macOS, Windows and Linux, with no native code. It needs Flutter 3.24 or later.
This guide uses anonymous chat. For signed-in customers, see Logged-in users after this.
1. Turn it on
In the chat agent, open Channels → Web widget and switch Anonymous usage on, then press Save. The same switch controls the website widget, the share link and anonymous chat in your app. Every setting is explained in Dashboard settings. You do not need to add anything to Allowed websites for an iOS, Android or desktop app. That list is checked against theOrigin header a browser sends, and native apps send none. A Flutter web build runs in a browser, so add its origin, as for any website.
2. Install the package
3. Add the launcher
Create the client once, for example in aState or your app’s dependency setup, and give it to the launcher. Use your agent’s ID: the agent_… value shown under the agent name in the dashboard.
OsviChatLauncher.open(context, client: chat). To place the chat inside a screen, use OsviChatView(client: chat); see Customise.
Both widgets use Material, so they need a MaterialApp above them.
OsviChatClient.create remembers the visitor and their current conversation on the device with shared_preferences, so a returning visitor picks up where they left off. Uninstalling the app or clearing its data starts a fresh visitor.4. Check it works
Run the app, tap the launcher and send a message. If the chat shows an error instead:
Every error code is listed in Error codes; the Flutter SDK uses the same codes.
Name clashes with Material
The package exports the transcript typesMessage and Divider. If a file that imports osvi_chat also uses Material’s Divider widget, hide the SDK’s one:
Next
- Change the colours, header and text: Customise.
- Connect the chat to signed-in customers: Logged-in users.
- Build your own interface on the client: Headless client.
- Before going live, read Security and limits. The limits for anonymous chat are the same in an app.
