kontext_flutter_sdk 1.0.4 copy "kontext_flutter_sdk: ^1.0.4" to clipboard
kontext_flutter_sdk: ^1.0.4 copied to clipboard

Flutter SDK for integrating Kontext.so ads. Monetize text-based & AI apps like chatbots, search or messaging with unique, native ad formats.

Kontext.so Flutter SDK #

The official Flutter SDK for integrating Kontext.so ads into your mobile applications.

Requirements #

Installation #

Add the package to your pubspec.yaml:

dependencies:
  kontext_flutter_sdk: ^<latest_version>

Then install:

flutter pub get

WebView prerequisites (flutter_inappwebview) #

This SDK renders ads inside a WebView using flutter_inappwebview. To avoid initialization issues, add this to your app entry point:

import 'package:flutter/widgets.dart';

void main() {
  // Must be first so plugins are ready.
  WidgetsFlutterBinding.ensureInitialized();

  runApp(const MyApp());
}

Make sure your project meets the Android min/compile SDK and iOS/Xcode requirements listed above. If you run into other issues, verify your project meets the plugin’s platform requirements: https://inappwebview.dev/docs/intro/

Quick start #

Wrap your app (or the subtree that contains ad placements) with AdsProvider. AdsProvider handles data fetching and needs access to the list of chat messages.

import 'package:kontext_flutter_sdk/kontext_flutter_sdk.dart';

AdsProvider(
  publisherToken: 'your_publisher_token',
  userId: 'user_id',
  conversationId: 'conversation_id',
  enabledPlacementCodes: ['your_code'], // ad codes you received during onboarding
  messages: <Message>[], // keep this in sync with your chat
  child: YourChatWidget(),
)

Display your first ad #

An ad slot is a place in your UI where an ad is rendered. In most cases, this will be under a chat message. During onboarding, you receive a code for each ad slot or ad format you want to show.

Example using the InlineAd format:

ListView.builder(
  itemCount: messages.length,
  itemBuilder: (context, index) {
    final message = messages[index];
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(message.content),
        InlineAd(
          code: 'your_code',
          messageId: message.id,
        ),
      ],
    );
  },
)

Integration notes #

  • Place AdsProvider high enough in the widget tree to cover all screens/areas that can show ads.
  • Keep the messages list up to date so the SDK can determine when and where to render ads.

Documentation #

For advanced usage, supported formats, and configuration details, see the docs: https://docs.kontext.so/sdk/flutter

License #

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

0
likes
0
points
881
downloads

Publisher

verified publisherkontext.so

Weekly Downloads

Flutter SDK for integrating Kontext.so ads. Monetize text-based & AI apps like chatbots, search or messaging with unique, native ad formats.

Homepage
Repository (GitHub)
View/report issues

Topics

#ads #sdk #flutter #monetization

Documentation

Documentation

License

unknown (license)

Dependencies

device_info_plus, flutter, flutter_hooks, flutter_inappwebview, http, package_info_plus, url_launcher

More

Packages that depend on kontext_flutter_sdk

Packages that implement kontext_flutter_sdk