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
- Register a site hostname in Nukta Ads (e.g. ai.nukta.co.tz). The package host must match that site.
- Create a placement sized for your slot (commonly 300×250).
- 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);
}
Consent on mobile
The package shows Accept/Decline the first time and stores the choice on device. Decline still allows a fill but skips targeting context and impression tracking — same rules as the web tag.
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.