onebear_chat 0.1.0
onebear_chat: ^0.1.0 copied to clipboard
OneBear live-chat SDK for Flutter — wraps the native Android/iOS chat SDKs so a customer app can embed the same OneBear agent-console conversation as every other channel.
onebear_chat #
Flutter SDK for the OneBear live-chat widget. Wraps the native
Android sdk/android OneBearChat SDK behind a Flutter platform channel, so a
customer app can embed the same OneBear agent-console conversation as every other channel
(LINE, Facebook, Instagram, WhatsApp, Email, TikTok, Lazada, Shopee).
Status: Android only in this release — see the design spec at
docs/superpowers/specs/2026-08-31-mobile-chat-sdk-design.md for the full mobile SDK
architecture (iOS and the underlying native shells land in a later release).
Getting started #
dependencies:
onebear_chat:
git:
url: https://github.com/GofiveCorp/Onebear.git
path: sdk/flutter
Usage #
import 'package:onebear_chat/onebear_chat.dart';
// Once, on app start — apiBaseUrl is the OneBear API origin.
await OnebearChat.configure(
publicKey: 'pk_live_...',
apiBaseUrl: 'https://app.onebear.example',
);
// Optional — identify a logged-in user. userHash MUST be computed by YOUR backend
// (HMAC of userId with your widget's secret) — never compute it in the app.
await OnebearChat.identify(
const OnebearIdentity(userId: 'u_123', userHash: 'server_computed_hash'),
);
// Badge your own UI — there is no built-in floating launcher on mobile.
OnebearChat.unreadCount.listen((count) {
// update a tab badge, etc.
});
// Open the chat full-screen from wherever your app's "Support" entry point is.
await OnebearChat.present();
// Call on sign-out — erases session, visitor token, unread count, and pending messages so
// the next person on a shared device never sees the previous user's conversation.
await OnebearChat.logout();
Events #
OnebearChat.events.listen((event) {
switch (event) {
case ChatOpened():
case ChatClosed():
case NewMessageReceived():
break;
case LinkTapped(:final url):
// The native SDK already opens agent-sent links in Custom Tabs — this is
// informational, not a request to handle it yourself.
break;
case ErrorOccurred(:final message):
break;
}
});
Known limitations (v1) #
- Android only (
minSdk 24). iOS is out of scope for this release. - Attachment upload requires a session-token bridge frame that does not exist yet — see
docs/superpowers/plans/2026-09-01-mobile-sdk-2-android.mdTask 8's notes. Core chat (configure/identify/present/logout/unreadCount/events) is unaffected.