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
dependencies:
flutter:
sdk: flutter
growwise_flutter:
path: ../growwise-flutter-sdk # adjust path / use published sourceflutter pub getAndroid 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
android {
defaultConfig {
minSdkVersion 21
}
}buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.4.2'
}
}apply plugin: 'com.google.gms.google-services'Initialize in main()
Call WidgetsFlutterBinding.ensureInitialized() before platform channels.
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)
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.
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.
await GrowWise.logout();Location & logging
- verbose — all events + HTTP bodies
- debug — URLs, queues, token updates
- info / warn / error / none
await GrowWise.setLocation(37.7749, -122.4194);
await GrowWise.setLocation(null, null); // clearawait GrowWise.setLogLevel(GrowWiseLogLevel.verbose);
await GrowWise.setLogLevel(GrowWiseLogLevel.none);Automatic page tracking
Register GrowWiseNavigatorObserver to log page_visited on Flutter navigations.
MaterialApp(
title: 'My App',
navigatorObservers: [
GrowWiseNavigatorObserver(),
],
initialRoute: '/',
routes: {
'/': (context) => HomeScreen(),
'/details': (context) => DetailsScreen(),
},
);Android 13+ notification permission
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.
<service
android:name="com.growwise.sdk.fcm.GrowWiseFirebaseService"
tools:node="remove"
xmlns:tools="http://schemas.android.com/tools" />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+