Skip to main content

adrian_chat 0.1.0 copy "adrian_chat: ^0.1.0" to clipboard
adrian_chat: ^0.1.0 copied to clipboard

Adrian live chat for Flutter apps. Opens your workspace's chat with forms, action buttons, chat flows and files, and shows an unread badge.

adrian_chat #

Adrian live chat for Flutter apps on iOS and Android.

The package opens your workspace's chat full screen in your brand colour. Customers get everything they have on your website: forms, action buttons, chat flows, file uploads, ratings, help center search and the AI agent. It also gives you a launcher button with an unread badge, and the unread count to show anywhere else in your app.

Home screen with the chat launcher A live conversation Unread replies on the launcher A form inside the chat

Features #

  • Full-screen messenger that follows your workspace's widget settings: colours, greeting, conversation starters and business hours.
  • AdrianLauncher: a round chat button with an unread badge, ready to use as a floatingActionButton.
  • Adrian.unreadCount: replies arrive while the chat is closed, because the chat loads in the background.
  • identify: attach the signed-in customer's name and email to the conversation.
  • Screen tracking: agents see which screen the customer is on, as app://<your app id>/<screen>.
  • reset on sign-out, so the next person on the device starts a fresh conversation.
  • Events for opened, closed, unread changes and new messages.

Install #

flutter pub add adrian_chat

To let customers attach photos on iOS, add these to ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>Take a photo to send to support.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Choose a photo to send to support.</string>

On Android, make sure android/app/src/main/AndroidManifest.xml has the internet permission. Flutter only adds it to debug builds, so release builds need it declared:

<uses-permission android:name="android.permission.INTERNET" />

Usage #

Find your workspace id in Adrian under Settings → Chat widget → Install. It's the same public id your website snippet uses.

import 'package:adrian_chat/adrian_chat.dart';
import 'package:flutter/material.dart';

final navigatorKey = GlobalKey<NavigatorState>();

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  Adrian.configure(
    workspaceId: 'ws_your_workspace_id',
    appId: 'com.acme.app', // shown to agents as app://com.acme.app/<screen>
    navigatorKey: navigatorKey,
  );
  runApp(MaterialApp(
    navigatorKey: navigatorKey,
    navigatorObservers: [AdrianNavigatorObserver()], // reports named routes as screens
    home: const HomePage(),
  ));
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: const AdrianLauncher(),
      body: ValueListenableBuilder<int>(
        valueListenable: Adrian.unreadCount,
        builder: (context, unread, _) => ListTile(
          title: const Text('Help & support'),
          subtitle: Text(unread > 0 ? '$unread new' : 'Chat with our team'),
          onTap: () => Adrian.present(context),
        ),
      ),
    );
  }
}

Signed-in customers #

// After sign-in
Adrian.identify(name: user.name, email: user.email);

// On sign-out: forget this visitor so the next person starts fresh
Adrian.reset();

identify labels the conversation. It doesn't prove who the customer is, so verify identity before account-sensitive changes, as you would on your website.

Screens #

AdrianNavigatorObserver reports each named route the user lands on. Pass nameOf to map unnamed routes, or call Adrian.trackScreen yourself:

AdrianNavigatorObserver(nameOf: (route) => route.settings.name ?? route.runtimeType.toString());

Adrian.trackScreen('Checkout');

Events and state #

Adrian.events.listen((event) {
  switch (event) {
    case AdrianMessageReceived(:final message):
      showBanner('${message.author}: ${message.body}');
    case AdrianUnavailable(:final reason):
      debugPrint('Chat unavailable: $reason');
    default:
      break;
  }
});
API Description
Adrian.configure(...) Start the chat in the background. Call once, early.
Adrian.present(context) / Adrian.dismiss() Open or close the messenger.
Adrian.identify(name:, email:) Attach the signed-in customer.
Adrian.trackScreen(name) Report the current screen.
Adrian.reset() Forget the visitor (sign-out).
Adrian.unreadCount ValueListenable<int>, 0 while the chat is open.
Adrian.primaryColor ValueListenable<Color>, your brand colour.
Adrian.latestMessage ValueListenable<AdrianMessagePreview?>, the newest unseen message.
Adrian.events Stream<AdrianEvent>: ready, opened, closed, unread changes, messages, unavailable.
Adrian.isAvailable false when the workspace has the chat switched off.

configure options:

  • openOnProactiveMessage: true opens the chat by itself when your team or a trigger starts a conversation. It needs navigatorKey.
  • widgetUrl is only for self-hosted Adrian.

How it works #

The package runs Adrian's hosted chat widget in a web view, behind a small native bridge. New chat features therefore reach your app without a package update. Only the widget's own pages load inside the web view; every other link opens in the system browser. Your app ships with the public workspace id only, and no API keys.

Example #

See example/lib/main.dart. Run it against your workspace with:

cd example
flutter run --dart-define=ADRIAN_WORKSPACE_ID=ws_your_workspace_id

License #

MIT. See LICENSE.

0
likes
150
points
185
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Adrian live chat for Flutter apps. Opens your workspace's chat with forms, action buttons, chat flows and files, and shows an unread badge.

Homepage
Repository (GitHub)
View/report issues

Topics

#chat #live-chat #customer-support #messaging #webview

License

MIT (license)

Dependencies

file_selector, flutter, url_launcher, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on adrian_chat