aaroh_chat 1.3.1+4 copy "aaroh_chat: ^1.3.1+4" to clipboard
aaroh_chat: ^1.3.1+4 copied to clipboard

Flutter chat SDK by Aaroh for AI-powered conversations, featuring built-in NLP, Claude API integration, and branding options.

aaroh_chat #

pub.dev License: MIT

A plug-and-play Flutter chat SDK โ€” add a fully branded AI assistant to your app in 5 minutes.

Built by Aaroh AI ยท Powered by Aaroh shown in every widget.


Features #

  • ๐Ÿ’ฌ 3-screen UI: Chat ยท History ยท Language
  • ๐Ÿข Company branding: Your name + logo in the header
  • ๐Ÿง  Built-in engine: Works offline, no API key needed
  • ๐Ÿค– Claude API support: Plug in your Claude key for smarter responses
  • ๐Ÿ“š Knowledge base: Feed company data โ€” bot answers from it
  • ๐Ÿ‘ Like / dislike feedback: Rate every assistant reply โ€” works in both Claude and built-in modes
  • ๐Ÿ“Š Analytics dashboard: On-device pie charts and bar graphs โ€” feedback breakdown by source
  • ๐ŸŒ Multilingual: English / Hindi / Hinglish
  • ๐Ÿ’พ Chat history: Auto-saved locally on device
  • ๐ŸŽ™๏ธ Voice input: Mic support built in
  • โšก Streaming: Real-time token streaming for Claude

Installation #

# pubspec.yaml
dependencies:
  aaroh_chat: ^1.3.0+3
flutter pub get

Quick Start #

Option 1 โ€” Full widget (new screen) #

import 'package:aaroh_chat/aaroh_chat.dart';

// Inside your widget tree:
AarohChatWidget(
  config: AarohConfig(
    companyName: 'MyCompany',
  ),
)

Option 2 โ€” Navigate to chat #

import 'package:aaroh_chat/aaroh_chat.dart';

ElevatedButton(
  onPressed: () => pushAarohChat(
    context,
    config: AarohConfig(companyName: 'MyCompany'),
  ),
  child: const Text('Open Chat'),
)

AarohConfig Reference #

Parameter Type Description
companyName String โœ… Your company/product name (shown in header)
companyLogoUrl String? URL of your company logo
claudeApiKey String? Claude API key โ€” enables AI mode
knowledgeBase List<Object> (String/KnowledgeItem) Company info, FAQs, product docs โ€” see Knowledge Base Format
searchEngineData List<Object> (String/KnowledgeItem) Same format as knowledgeBase, separate list for your own organization
knowledgeMatchThreshold int Built-in engine: min keyword overlap to trigger a knowledge answer (default 1)
topics List<TopicRule> Rule-based replies โ€” "if user asks X, reply Y", with optional deep-link action. See Topics & Rule-Based Replies
support SupportConfig? Support email / Contact Us link / phone (phone shown only if asked). See Support Fallback
fallbackReply String? Shown in built-in engine mode when nothing else matches
enableFeedback bool Show like / dislike buttons under assistant replies (default true)
enableAnalytics bool Show analytics dashboard icon in AppBar (default true)
botGreeting String? Custom welcome message
primaryColor String? Brand color hex e.g. '#E07A5F'
poweredByText String Footer text (default: 'Powered by Aaroh')

Knowledge Base Format #

knowledgeBase and searchEngineData both accept a List containing either:

  • Plain Strings โ€” quick and simple
  • KnowledgeItem objects โ€” structured, with categories and keywords for better matching

You can mix both freely in the same list.

Plain strings (simplest) #

knowledgeBase: [
  'ShopMart sells electronics, clothing, and home goods.',
  'We offer free delivery on orders above โ‚น500.',
  'Return policy: 30-day hassle-free returns.',
],
knowledgeBase: [
  KnowledgeItem(
    id: 'return-policy',          // optional, your own reference id
    question: 'What is your return policy?',
    answer: '30-day hassle-free returns, no questions asked.',
    category: 'Policies',         // optional, for your own organization
    keywords: ['refund', 'exchange', 'send back'], // optional, boosts matching
  ),
  KnowledgeItem(
    answer: 'ShopMart was founded in 2020 and ships across India.',
    // question/category/keywords are all optional โ€” this is just a fact
  ),
],
Field Required Purpose
id No Stable reference if you update/remove entries later
question No The question this answers โ€” omit for plain facts/docs
answer Yes The answer text or fact content
category No Grouping label, e.g. 'Pricing', 'Shipping'
keywords No Extra search terms beyond what's in question/answer

How it's used in each mode #

  • Claude API mode โ€” every entry (string or KnowledgeItem) is formatted and joined into Claude's system prompt automatically. Claude reasons over all of it.
  • Built-in engine mode (no claudeApiKey) โ€” each incoming message is keyword-matched against your knowledge base. If a confident match is found, the bot answers directly from that entry's answer instead of its generic wellness response. Tune sensitivity with knowledgeMatchThreshold (default 1 โ€” at least one matching keyword).
AarohConfig(
  companyName: 'ShopMart',
  knowledgeBase: [ /* ... */ ],
  knowledgeMatchThreshold: 2, // require 2+ overlapping keywords to trigger
)

Full example #

AarohChatWidget(
  config: AarohConfig(
    companyName: 'ShopMart',
    claudeApiKey: 'sk-ant-YOUR_KEY', // omit to use built-in engine
    knowledgeBase: [
      'ShopMart sells electronics, clothing, and home goods.',
      KnowledgeItem(
        question: 'What is your return policy?',
        answer: '30-day hassle-free returns, no questions asked.',
        category: 'Policies',
        keywords: ['refund', 'exchange'],
      ),
      KnowledgeItem(
        question: 'Do you offer EMI?',
        answer: 'Yes, on orders above โ‚น2000 via major banks.',
        category: 'Payments',
      ),
    ],
    botGreeting: 'Hi! I\'m ShopMart\'s assistant. Ask me anything!',
  ),
)

Topics & Rule-Based Replies #

For general questions that aren't facts (e.g. "what's your pricing?", "track my order"), define TopicRules โ€” "if the user asks about X, reply with Y", with an optional deep link.

topics: [
  TopicRule(
    triggers: ['pricing', 'plans', 'cost', 'how much'],
    reply: 'Here are our current plans:',
    action: MessageAction(label: 'View Pricing', route: '/pricing'),
  ),
  TopicRule(
    triggers: ['track order', 'where is my order'],
    reply: 'Let me pull that up for you.',
    action: MessageAction(label: 'Track Order', actionId: 'track_order'),
  ),
],

topics is checked first, before the knowledge base โ€” first matching rule wins.

MessageAction โ€” three ways to handle a tap #

Field Use for
route A named route in your own app (e.g. /pricing), pushed via Navigator.pushNamed. Works automatically with pushAarohChat (reuses your app's Navigator). With AarohChatWidget, pass your route table via its routes or onGenerateRoute param.
url An external link (e.g. https://yoursite.com/contact), opened in the browser.
actionId An arbitrary string passed to your own onAction callback โ€” run any custom logic.

You can set more than one โ€” onAction fires first, then route is tried, falling back to url if route doesn't resolve.

pushAarohChat(
  context,
  config: myConfig,
  onAction: (actionId) {
    if (actionId == 'track_order') {
      // your own logic โ€” open a bottom sheet, call an API, etc.
    }
  },
)

Support Fallback #

When a message looks support-related (e.g. "I need help", "this isn't working") and no TopicRule or knowledge entry matched, the bot uses SupportConfig:

support: SupportConfig(
  email: 'support@shopmart.com',        // shown by default
  contactUsUrl: 'https://shopmart.com/contact', // shown as a button if set
  phoneNumber: '1800-XXX-XXXX',         // shown ONLY if user explicitly asks for it
),
  • Email is always shown for support-style queries.
  • Contact Us link is shown as a tappable button if you set contactUsUrl.
  • Phone number is never shown proactively โ€” only when the user explicitly asks ("what's your number", "can I call you").

If nothing matches at all โ€” not a topic, not knowledge, not a support query โ€” fallbackReply is shown:

fallbackReply: "I'm not sure about that. Try asking about pricing, "
    "your order, or our return policy.",

If you don't set fallbackReply, a generic safe default is used instead.


Like / Dislike Feedback #

Every assistant reply shows thumb up / thumb down buttons (when enableFeedback is true). Ratings are saved locally and tracked by response source โ€” Claude AI, knowledge base, topic rules, support, or fallback.

Works identically in Claude API mode and built-in knowledge-base mode.

pushAarohChat(
  context,
  config: myConfig,
  onFeedback: (messageId, feedback, content, source) {
  // Send to your backend analytics, e.g.:
  // analytics.log('chat_feedback', {id: messageId, rating: feedback.name, source: source?.name});
  },
)

Tap the same button again to clear the rating.


Analytics Dashboard #

Open the ๐Ÿ“Š bar chart icon in the chat AppBar to view on-device analytics:

Chart What it shows
Pie chart Liked vs disliked vs unrated replies
Bar chart Likes and dislikes broken down by response source
Progress bars Total messages per source (Claude, KB, topics, support, fallback)

All data is computed from locally stored chat history โ€” nothing is sent to a server.

Disable the dashboard with enableAnalytics: false in AarohConfig.

You can also read stats programmatically via ChatAnalyticsSummary (exported from the package) if you want to build your own dashboard in the host app.


Claude API Setup #

  1. Get your key at console.anthropic.com
  2. Pass it as claudeApiKey in AarohConfig
  3. Your knowledgeBase and searchEngineData are automatically injected into Claude's system prompt

Model used: claude-sonnet-4-6


Screens #

Screen How to access
Chat Main screen (default)
Analytics ๐Ÿ“Š icon in AppBar top-right
History ๐Ÿ• icon in AppBar top-right
Language ๐ŸŒ icon in AppBar top-right

Language Options #

Option Code
English LanguageTone.english
Hindi LanguageTone.hindi
Hinglish LanguageTone.hinglish

Publishing to pub.dev #

See PUBLISHING.md for step-by-step instructions.


License #

MIT ยฉ Aaroh AI

5
likes
135
points
177
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter chat SDK by Aaroh for AI-powered conversations, featuring built-in NLP, Claude API integration, and branding options.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

fl_chart, flutter, google_fonts, http, intl, provider, shared_preferences, speech_to_text, url_launcher, uuid

More

Packages that depend on aaroh_chat