FlutterFever Studio
Back to packages

Netmera Flutter Sdk package guide

A Flutter SDK for Netmera's mobile engagement platform, offering push, in‑app messaging, analytics and user segmentation.

Install command
Copy and run in your Flutter project
flutter pub add netmera_flutter_sdk

When to use Netmera Flutter Sdk

The Netmera Flutter SDK bridges your Flutter application with Netmera’s powerful mobile engagement platform. By integrating this package, developers gain instant access to a suite of tools that handle push notifications, in‑app messages, event tracking, and audience segmentation without writing native code for each platform. The SDK abstracts platform‑specific details, exposing a clean, Dart‑first API that works seamlessly on both Android and iOS. Whether you’re building a simple news app that needs to alert users about breaking stories, or a complex e‑commerce solution that personalises offers based on user behaviour, Netmera provides the backend infrastructure to deliver timely, context‑aware communications.

When to use Netmera? If your product relies on real‑time user engagement—such as onboarding flows, promotional campaigns, or behavioural triggers—this SDK is a natural fit. It integrates well with common Flutter architectures (Provider, Riverpod, BLoC, Clean) and can be placed at the root of your widget tree or inside a dedicated service layer. By keeping the SDK initialization separate from UI code, you maintain a clear separation of concerns, making it easy to test and evolve your app’s business logic.

Setting up the SDK is straightforward. After adding the dependency with `flutter pub add netmera_flutter_sdk`, you initialise the client with your Netmera API key, optionally configuring logging, notification channels, and custom event handlers. The package respects Flutter’s lifecycle, automatically handling token refreshes and background message delivery. For production, ensure you enable the appropriate Android manifest permissions and iOS capabilities (push notifications, background fetch). It is also advisable to test the SDK in a staging environment before rolling out to all users, as push payloads and in‑app templates can behave differently across device manufacturers.

From a performance standpoint, Netmera operates asynchronously, leveraging isolates where needed to avoid blocking the UI thread. The SDK caches user identifiers locally, reducing network chatter, and provides callbacks for delivery receipts and click‑through analytics. Developers should be mindful of privacy regulations—store only the data required for segmentation, and respect user opt‑out preferences by disabling the SDK at runtime when necessary. Comprehensive error handling is built in, but logging can be tuned to avoid exposing sensitive information in release builds.

Beginner‑friendly use cases include: sending a welcome push after sign‑up, tracking screen views for analytics, and displaying a promotional banner via in‑app messaging. Advanced scenarios involve dynamic audience segmentation based on custom events, A/B testing of message content, and chaining multiple engagement actions (e.g., push → deep link → in‑app survey). The SDK’s flexible API lets you craft both simple one‑off messages and sophisticated, rule‑based campaigns, making it a versatile tool for any Flutter developer looking to boost user retention and conversion.

welcome push after registration
in‑app promotional banners
event‑driven user segmentation
A/B testing of message content
real‑time analytics for screen views

Pros

  • single API for push, in‑app and analytics
  • works on both Android and iOS
  • asynchronous, non‑blocking design
  • extensive documentation and sample code
  • supports audience segmentation

Watch outs

  • no web or desktop support yet
  • requires native configuration for push
  • depends on external Netmera service

Setup notes

Add the dependency with: ``` flutter pub add netmera_flutter_sdk ``` Then run `flutter pub get`. Import the package, initialize it in `main()` with your Netmera API key, and configure platform‑specific settings in AndroidManifest.xml and Info.plist as described in the documentation.

Requires Flutter 3.0 or higher. Supports Android API 21+ and iOS 12+. Web and desktop platforms are not currently supported. Ensure you have the appropriate Google Services JSON/Plist files for push notifications.

```dart
import 'package:flutter/material.dart';
import 'package:netmera_flutter_sdk/netmera_flutter_sdk.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Netmera.initialize(
    apiKey: 'YOUR_NETMERA_API_KEY',
    enableLogging: kDebugMode,
  );
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Netmera Demo')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              await Netmera.sendPush(
                title: 'Hello from Netmera',
                message: 'This is a test notification',
                targetUserId: 'user_123',
              );
            },
            child: const Text('Send Test Push'),
          ),
        ),
      ),
    );
  }
}
```

Official package resources