pnlight_sdk 0.4.1 copy "pnlight_sdk: ^0.4.1" to clipboard
pnlight_sdk: ^0.4.1 copied to clipboard

Flutter wrapper for PNLight iOS SDK.

PNLight SDK - Flutter Plugin #

pub package

A Flutter plugin that provides iOS integration with the PNLight SDK, enabling comprehensive app analytics, purchase tracking, and device motion monitoring.

Features #

  • 🚀 Easy iOS SDK integration for Flutter apps
  • 📊 Automatic app start and first install tracking
  • 💳 In-app purchase validation and tracking
  • 📱 Device motion and orientation monitoring
  • 🎯 Custom event logging with parameters
  • 🔒 Privacy-compliant IDFA collection (with user consent)
  • 📈 Real-time analytics and reporting

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  pnlight_sdk: ^0.1.0

Then run:

flutter pub get

iOS Setup #

  1. If you use RemoteUiView, add the DivKit CocoaPods source to your app's ios/Podfile (before other sources):

    source 'https://github.com/divkit/divkit-ios.git'
    
  2. Add the required frameworks to your iOS project in Xcode:

    • StoreKit.framework
    • CoreMotion.framework
    • AdSupport.framework
    • AppTrackingTransparency.framework (iOS 14.0+)
  3. For iOS 14.0+ apps that need IDFA tracking, add the NSUserTrackingUsageDescription key to your Info.plist:

<key>NSUserTrackingUsageDescription</key>
<string>This app uses device tracking to provide personalized analytics and improve user experience.</string>

Usage #

Initialize the SDK #

Initialize the PNLight SDK with your API key in your app's main function:

import 'package:pnlight_sdk/pnlight_sdk.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize PNLight SDK
  await PNLightSDK.initialize('YOUR_API_KEY_HERE');

  runApp(MyApp());
}

Validate Purchases #

Automatically validate in-app purchases:

bool isValid = await PNLightSDK.validatePurchase(); // captcha defaults to true
// Or disable captcha: bool isValid = await PNLightSDK.validatePurchase(captcha: false);
// Handle validation result

Remote UI View (iOS) #

Display remote UI (DivKit) for a placement. Fetches config via getUIConfig(placement) and renders it in a native view. Use for in-app screens driven by the backend (e.g. paywall, prompts).

import 'package:pnlight_sdk/pnlight_sdk.dart';

// In your widget tree:
RemoteUiView(
  placement: 'your_placement_id',
  cardId: 'pnlight_card', // optional, defaults to pnlight_<placement>
  onAction: (RemoteUiActionEvent event) {
    // Handle custom actions (non-http(s) URLs from the view)
    print('Action: ${event.scheme} ${event.path} ${event.params}');
  },
)

Requires the DivKit Podfile source (see iOS Setup above).

Log Custom Events #

Track custom events with optional parameters:

// Simple event
await PNLightSDK.logEvent('button_tapped');

// Event with parameters
await PNLightSDK.logEvent('purchase_completed', {
  'product_id': 'premium_subscription',
  'amount': 9.99,
  'currency': 'USD',
});

Platform Support #

  • ✅ iOS 12.0+
  • ❌ Android (iOS only SDK)

Requirements #

  • Flutter: >=3.3.0
  • Dart: >=2.17.0 <4.0.0
  • iOS: 12.0+

License #

This plugin wraps the PNLight SDK. Please refer to the PNLight website for licensing information.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

Support #

For support and questions, visit pnlight.app or create an issue in this repository.

0
likes
0
points
45
downloads

Publisher

verified publisherpnlight.app

Weekly Downloads

Flutter wrapper for PNLight iOS SDK.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on pnlight_sdk

Packages that implement pnlight_sdk