Koah Flutter
Contextual, LLM-aware ads for Flutter apps. Monetize your AI chat or assistant with native ad cards that read the surrounding conversation — no ad IDs, no tracking across apps.
- SwiftUI-style widget API — drop in a
KoahCard, the SDK fetches and renders. - Fail-safe by design — a backend hiccup never crashes your app; the slot just stays empty.
- Themable — match your app's colors, fonts, and corner radius.
Installation
Add the dependency to your pubspec.yaml:
dependencies:
koah_flutter: 1.0.0-beta.1
Then get a publisher ID from app.koah.ai.
Initialize
Initialize once at startup, before any Koah widget is built:
import 'package:koah_flutter/koah_flutter.dart';
void main() {
// Required before touching any plugin ahead of runApp.
WidgetsFlutterBinding.ensureInitialized();
Koah.instance(publisherId: 'your-publisher-id');
runApp(MyApp());
}
Koah.instance(...) is idempotent — call it with the publisher ID once; later calls return the same instance.
Display an ad
Place a KoahCard where you want the ad, giving it the surrounding context and a stable cacheKey so it isn't re-fetched on rebuild. It renders nothing while loading or on a no-fill.
KoahCard(
adContext: KoahAdContext.conversation(
question: 'How do I center a widget?',
answer: 'Wrap it in a Center widget.',
),
cacheKey: message.id,
)
Ad contexts
Pick the context that matches where the ad appears:
KoahAdContext.conversation(question: q, answer: a); // chat / assistant replies
KoahAdContext.article(title: t, content: c); // long-form content
KoahAdContext.feed(text: t); // social / feed items
KoahAdContext.static_(); // no surrounding context
Theming
Wrap your app (or a subtree) in a KoahThemeProvider to match your brand. For an inline, borderless ad, pass chrome: KoahCardChrome.bare to the card.
Sizing
The SDK is sizeless — it serves the format that fits the room you give it. Bound a slot with width / height (each a KoahAxisSize: fixed, range, or fill), or leave them unset so the card wraps its content and every format is eligible.
Learn more
- Full guide, theming, and API reference: docs.koahlabs.com
- A complete chat-style integration: the example tab
- Questions: support@koahlabs.com
Maintained by Koah Labs Inc. Licensed under Apache 2.0.
Libraries
- internal_testing
- Internal-testing surface for the demo Sizing Playground and diagnostics.
- koah_flutter