Appearance
Flutter SDK
Deliver sponsored push notifications in your Flutter app on Android. The plugin wraps the native Android SDK — all business logic runs in Kotlin.
Prerequisites
- Flutter 3.0+
- Firebase configured with
google-services.jsoninandroid/app/ - Android build target
Install
Add to your pubspec.yaml:
yaml
dependencies:
dlserve_flutter: ^0.1.0Then run flutter pub get.
Quick start
dart
import 'package:dlserve_flutter/dlserve_flutter.dart';
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
Dlserve.init('your-app-id');
}
}The SDK handles device registration, FCM token management, and notification display automatically.
User identity & tags
dart
Dlserve.login('user-123');
Dlserve.logout();
Dlserve.setTags({'plan': 'premium', 'trial': null}); // null deletes the keyAPI reference
| Method | Description |
|---|---|
Dlserve.init(String appId) | Initialize the SDK. Call once, early. |
Dlserve.login(String externalId) | Associate a user ID (max 256 chars). |
Dlserve.logout() | Clear user association. |
Dlserve.setTags(Map<String, String?> tags) | Set tags; null deletes. Max 20 tags. |
All methods return Future<void> and complete when the native call returns.
FCM routing
The Flutter plugin delegates FCM message handling to the native Android SDK. Messages are routed automatically — dlserve ad pushes are displayed with a "Sponsored" label; all other messages pass through to your app's handler.