πŸ’™

Flutter SDK

Dart Β· Flutter 3.10+ Β· Material 3

Overview

WINR lets you add daily-entry sweepstakes and prize experiences to your app with a single configuration call. The SDK automatically opens the experience on the first app-open of each day, captures the user, and claims their daily entries β€” no scheduling or session logic on your side. You customize your logo, prize image, and brand color from the WINR dashboard; everything else is managed server-side.

Requirements

Flutter3.10+
Dart3.0+
PlatformiOS 13+ / Android API 21+
Publisher API KeyContact info@avafli.com

Installation

Add to pubspec.yaml

Add the dependency to your pubspec.yaml:

dependencies:
  winr_flutter_sdk: ^2.9.0

Then install the package:

flutter pub get

Quick Start

One call at app launch is the entire integration:

main.dart
import 'package:winr_flutter_sdk/winr_flutter_sdk.dart';

await WINR.configure(WINRConfiguration(
  apiKey: 'YOUR_API_KEY', // debug builds: use your winr_test_ sandbox key
  bundleId: 'com.example.myapp',
  user: WINRUser(
    id: 'user_123',             // only id is required β€” pass whatever identity you have
    firstName: 'Jane',
    lastName: 'Doe',
    email: 'jane@example.com',  // include it when you have it β€” pre-fills & locks the capture form
  ),
  // Nobody signed in? use user: WINRUser.guest
  options: WINROptions(
    logging: LoggingLevel.error,  // LoggingLevel.debug while integrating
    enablePushReminders: true,    // then forward tokens: WINR.registerPushToken(token)
  ),
));

// Attach the navigator key: MaterialApp(navigatorKey: WINR.navigatorKey, ...)
// Splash that clears the nav stack? holdAutoOpen() before configure, releaseAutoOpen() after.

Attach the SDK’s navigator key β€” MaterialApp(navigatorKey: WINR.navigatorKey) β€” and the experience opens itself on the first app-open of each day. There is no manual launch API; presentation timing, the daily cadence, and dismissal are fully managed by the SDK. If your app boots through a splash screen or auth gate that ends by clearing the navigation stack (Get.offAll, pushAndRemoveUntil), call WINR.holdAutoOpen() before configuring and WINR.releaseAutoOpen() once your main screen is mounted, so the drawer isn’t destroyed by your boot navigation.

Push Notifications

Drive re-engagement with daily reminders. Forward your FCM token to WINR:

import 'package:firebase_messaging/firebase_messaging.dart';

// Get the FCM token and forward it to WINR
final fcmToken = await FirebaseMessaging.instance.getToken();
if (fcmToken != null) {
  await WINRPushNotificationManager.instance.didReceiveRegistrationToken(fcmToken);
}

// Listen for token refreshes
FirebaseMessaging.instance.onTokenRefresh.listen((token) {
  WINRPushNotificationManager.instance.didReceiveRegistrationToken(token);
});

Upload your FCM service account key via the WINR Dashboard to enable push notifications.

Branding

Branding is configured server-side β€” no code changes needed. Publishers customize three things β€” their logo, the prize image, and their primary brand color β€” via the Customize Experience section in the publisher dashboard. Everything else is designed and managed by WINR. Changes take effect immediately in the SDK.

Analytics

Connect your analytics system to track user engagement:

class MyAnalyticsAdapter implements AnalyticsAdapter {
  @override
  void trackEvent(String name, Map<String, dynamic> properties) {
    // Forward to Segment, Amplitude, Mixpanel, etc.
    analytics.track(name, properties);
  }
}

// Pass during configuration
await WINR.configure(WINRConfiguration(
  // ... other config
  options: WINROptions(
    analyticsAdapter: MyAnalyticsAdapter(),
  ),
));

GDPR Compliance

Handle erasure requests with a single method call. It removes the person's personal information everywhere it is held, covers all their devices, and keeps the experience silenced through a reinstall:

// Erase the user's personal data (Right-to-be-Forgotten)
await WINR.optOut();

Testing? Your dashboard also shows a winr_test_ sandbox key. Use it in debug builds: identical behavior against the production backend, but users and entries land in an isolated sandbox β€” your testers can never enter your real giveaway, and sandbox usage never counts toward MAU.

SDK Features

Escalating Streak Ladder with Milestone Accelerators
Daily or Visit-Based Streak Modes
Winner Announcements & Celebrations
Auto-Open on First Daily App-Open
Email Capture & Age Gate (18+)
Push Notifications (FCM)
Server-Driven Configuration
GDPR Compliance
Offline Resilience
Built-in Analytics Support
Custom Logo, Prize Image & Brand Color
Cross-platform (iOS/Android)

Full API Reference & Code Examples

View the complete documentation on GitHub including API reference, code examples, and advanced configuration.