Nukta Ads

Guides / Flutter

Integrate with your Flutter app

Add the official nukta_ads package, point it at your registered host and placement, and drop in NuktaAdView.

Get the package

Install from the Nukta Ads pub server (hosted on this site).

dependencies:
  nukta_ads:
    hosted: https://angaza.nukta.co.tz/pub
    version: ^0.1.0
flutter pub get

Uses https://angaza.nukta.co.tz/pub — no GitHub clone required.

Before you start

  1. Register a site hostname in Nukta Ads (e.g. ai.nukta.co.tz). The package host must match that site.
  2. Create a placement sized for your slot (commonly 300×250).
  3. Ensure at least one approved ad matches the size (and any category/context filters).

Drop-in widget

NuktaAdView asks for consent once, fetches a fill, renders the creative, and records an impression when the ad is delivered.

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

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ListView(
        children: [
          // your content …
          Center(
            child: NuktaAdView(
              placementCode: 'YOUR_PLACEMENT_CODE',
              config: const NuktaAdsConfig(
                host: 'YOUR_REGISTERED_DOMAIN',
                baseUrl: 'https://angaza.nukta.co.tz',
                locale: 'sw',
              ),
              contextKeys: const {
                'section': 'app',
                'content_type': 'mobile',
                'lang': 'sw',
              },
            ),
          ),
        ],
      ),
    );
  }
}

Replace YOUR_PLACEMENT_CODE and YOUR_REGISTERED_DOMAIN with values from your publisher dashboard.

Advanced client API

final client = NuktaAdsClient(
  const NuktaAdsConfig(host: 'YOUR_REGISTERED_DOMAIN'),
);
final ad = await client.fetchAd(
  'YOUR_PLACEMENT_CODE',
  consented: true,
  context: {'section': 'news'},
);
if (ad != null) {
  await client.trackImpression(ad, consented: true);
  await client.openClick(ad);
}

Checklist

  • config.host matches the registered site domain (apex/www rules still apply).
  • Placement size matches creatives you expect to fill.
  • Network allows HTTPS to angaza.nukta.co.tz.
  • Test with consent accepted and declined.

Web project →