Flutter SDK

Flutter plugin (growwise_flutter) wrapping the native Android GrowWise SDK via MethodChannel. Push, analytics, identity, location, logging, and automatic page_visited tracking. Current host support: Android.

Overview

Add growwise_flutter to your Flutter app, configure the Android host (Firebase + notification icon), then initialize before runApp. Native push styles and in-app campaigns are handled by the Android SDK underneath.

  • Package: growwise_flutter (path / git / hosted)
  • minSdkVersion ≥ 21 on Android
  • API surface: initialize, logIn, logEvent, logout, setLocation, setLogLevel, handleFcmPayload

Setup & installation

pubspec.yamlyaml
dependencies:
  flutter:
    sdk: flutter
  growwise_flutter:
    path: ../growwise-flutter-sdk  # adjust path / use published source
Fetchbash
flutter pub get

Android host configuration

Configure Firebase and icons under android/.

  • Put google-services.json in android/app/
  • Add white silhouette drawable android/app/src/main/res/drawable/ic_notification.xml (or .png)
  • Pass resource name without extension to smallIconName
  • Transitive deps (FCM, Glide, AndroidX) come from the plugin — no need to add manually
minSdkgroovy
android {
    defaultConfig {
        minSdkVersion 21
    }
}
Project build.gradle classpathgroovy
buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.4.2'
    }
}
App build.gradlegroovy
apply plugin: 'com.google.gms.google-services'

Initialize in main()

Call WidgetsFlutterBinding.ensureInitialized() before platform channels.

lib/main.dartdart
import 'package:flutter/material.dart';
import 'package:growwise_flutter/growwise_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await GrowWise.initialize(
    apiKey: 'YOUR_API_KEY',
    smallIconName: 'ic_notification',
    logLevel: GrowWiseLogLevel.debug, // verbose | debug | info | warn | error | none
    latitude: 28.6139,  // optional
    longitude: 77.2090, // optional
  );

  runApp(const MyApp());
}

User authentication (logIn)

logIndart
await GrowWise.logIn(
  'user_12345',
  {
    'Name': 'Jane Doe',
    'Email': 'jane@example.com',
    'membership': 'Premium',
    'signup_date': '2026-08-16',
  },
);

Behavioral events (logEvent)

SDK manages offline caching and batch flush. Automatic system events include SDK Initialized, In-App Message Viewed/Clicked/Dismissed, Push Unsubscribed.

logEventdart
await GrowWise.logEvent('app_opened');

await GrowWise.logEvent(
  'product_viewed',
  {
    'item_id': 'prod_headphone_2026',
    'price': 199.99,
    'in_stock': true,
  },
);

Logout

Resets authenticated profile and registers a new anonymous identity for subsequent events.

logoutdart
await GrowWise.logout();

Location & logging

  • verbose — all events + HTTP bodies
  • debug — URLs, queues, token updates
  • info / warn / error / none
Location overridedart
await GrowWise.setLocation(37.7749, -122.4194);
await GrowWise.setLocation(null, null); // clear
Log levelsdart
await GrowWise.setLogLevel(GrowWiseLogLevel.verbose);
await GrowWise.setLogLevel(GrowWiseLogLevel.none);

Automatic page tracking

Register GrowWiseNavigatorObserver to log page_visited on Flutter navigations.

MaterialAppdart
MaterialApp(
  title: 'My App',
  navigatorObservers: [
    GrowWiseNavigatorObserver(),
  ],
  initialRoute: '/',
  routes: {
    '/': (context) => HomeScreen(),
    '/details': (context) => DetailsScreen(),
  },
);

Android 13+ notification permission

permission_handler exampledart
await Permission.notification.request();

Coexisting with another FirebaseMessagingService

Android allows one FCM intent handler. If your app already owns FCM, remove the SDK service and forward from Dart.

AndroidManifest — remove SDK servicexml
<service
    android:name="com.growwise.sdk.fcm.GrowWiseFirebaseService"
    tools:node="remove"
    xmlns:tools="http://schemas.android.com/tools" />
Forward from Dartdart
void setupFCMForwarding() {
  FirebaseMessaging.instance.onTokenRefresh.listen((token) {
    GrowWise.setPushToken(token);
  });

  FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
    Map<String, String> data =
        message.data.map((k, v) => MapEntry(k, v.toString()));

    bool handled = await GrowWise.handleFcmPayload(data);
    if (!handled) {
      // your own push handling
    }
  });
}

Flutter checklist

  • Plugin in pubspec.yaml
  • minSdkVersion ≥ 21
  • google-services.json in android/app/
  • Google Services plugin applied
  • ic_notification drawable exists
  • GrowWise.initialize before runApp
  • Notification permission on Android 13+