AdMesh Flutter UI SDK
admesh_flutter_ui_sdk is the native Flutter SDK for rendering AdMesh recommendations with built-in tracking, theming, and format-aware widgets.
Why This Package
- Native Flutter widgets for
tail,product_card,bridge, and sponsored follow-up recommendation flows /aip/contextintegration through a typedAdMeshSdk- Provider-based session, tracker, and SDK access
- Impression, click, and follow-up engagement tracking
ThemeExtension-based styling with light/dark support
Installation
dependencies:
admesh_flutter_ui_sdk: ^0.2.0
Requirements
- Flutter
3.19.0+ - Dart
3.3.0+ - A valid AdMesh API key
Latest Schema Only
Version 0.2.0 is aligned to the latest AdMesh schema only.
AdMeshSdk.showRecommendations()returnsPlatformResponse- widgets render directly from
PlatformResponse - no legacy flattened recommendation payloads are supported
- no prompt-paste bridge fallback is included
Quick Start
Direct SDK usage
import 'package:admesh_flutter_ui_sdk/admesh_flutter_ui_sdk.dart';
final sdk = AdMeshSdk(
config: const AdMeshSdkConfig(apiKey: 'your-api-key'),
);
final sessionId = AdMeshSdk.createSession();
final messageId = AdMeshSdk.createMessageId(sessionId);
final response = await sdk.showRecommendations(
ShowRecommendationsOptions(
query: 'best CRM for small business',
sessionId: sessionId,
messageId: messageId,
platformSurface: 'mobile_chat',
locale: 'en-US',
geo: 'US',
),
);
final title = response.title;
final destinationUrl = response.destinationUrl;
apiBaseUrl defaults internally to https://api.useadmesh.com. Only override it for non-production environments or custom routing.
Provider + widget integration
import 'package:admesh_flutter_ui_sdk/admesh_flutter_ui_sdk.dart';
import 'package:flutter/material.dart';
class AdMeshDemo extends StatelessWidget {
const AdMeshDemo({super.key});
@override
Widget build(BuildContext context) {
final sessionId = AdMeshSdk.createSession();
return AdMeshProvider(
config: const AdMeshSdkConfig(apiKey: 'your-api-key'),
sessionId: sessionId,
child: AdMeshRecommendations(
loadRecommendation: (sdk) => sdk.showRecommendations(
ShowRecommendationsOptions(
query: 'best CRM for small business',
sessionId: sessionId,
messageId: AdMeshSdk.createMessageId(sessionId),
),
),
onExecuteQuery: (query) async {
// Handle sponsored follow-up query execution.
},
onOpenLink: (url) async {
// Open the destination URL after tracking fires.
},
),
);
}
}
Public API
The documented surface for 0.2.0 is:
AdMeshSdk,AdMeshSdkConfig,ShowRecommendationsOptionsPlatformResponse,PlatformRecommendation,PlatformCreative,PlatformTracking,Delegation,ProductAdMeshProvider,AdMeshScope.of(context)AdMeshRecommendations,AdMeshLayoutAdMeshEcommerceCards,AdMeshBridgeFormat,AdMeshFollowup,AdMeshBadgeAdMeshTracker,AdMeshViewabilityTracker,AdMeshLinkTrackerAdMeshThemeData
Supported Formats
| Format | Purpose | Primary widget |
|---|---|---|
tail |
Summary-first recommendation panel | AdMeshRecommendations / AdMeshLayout |
product_card |
Product carousel rendering | AdMeshEcommerceCards |
bridge |
Link-out CTA rendering | AdMeshBridgeFormat |
| Sponsored follow-up | Suggested next query with tracking | AdMeshFollowup |
AdMeshLayout chooses the widget based on backend response metadata:
product_cardwithrecommendation.creative.products[]rendersAdMeshEcommerceCardsbridgerendersAdMeshBridgeFormat- other generated responses render the tail-style layout
Tracking
The package includes first-party tracking primitives:
AdMeshTrackerfor exposure, click, and follow-up engagement requestsAdMeshViewabilityTrackerfor impression firing after visibility threshold and durationAdMeshLinkTrackerfor firing click tracking before opening the destination URL
Impression tracking defaults to the Flutter SDK’s MRC-style behavior: 50% visible for 1 second before firing exposure.
Theming
Use AdMeshThemeData as a ThemeExtension:
MaterialApp(
theme: ThemeData(
useMaterial3: true,
extensions: <ThemeExtension<dynamic>>[
AdMeshThemeData.light(),
],
),
home: const Placeholder(),
)
You can customize accent colors, surface colors, typography, spacing, and border radius while keeping the recommendation widgets on the same theme system as the rest of your app.
Flutter-specific Limitations
- Native Flutter widget parity is included for tail,
product_card,bridge, and sponsored follow-up flows /aip/contextintegration is included- DOM-based Weave link mutation, CSS injection, and browser-specific link processing are not part of the Flutter SDK
Example App
The package includes an example app under example/ that shows:
- static ecommerce rendering
- bridge rendering using the latest schema
- sponsored follow-up execution
- direct SDK fetch flow
Publish Validation
Before publishing to pub.dev, run these commands from the package root:
flutter pub get
flutter analyze
flutter test
flutter analyze example
flutter pub publish --dry-run
Links
- Documentation: https://docs.useadmesh.com/ui-sdk/flutter
- GitHub: https://github.com/GouniManikumar12/admesh-flutter-ui-sdk
- Product: https://useadmesh.com