API Reference
Complete Flutter SDK properties and methods reference
Properties
onDeeplinkReceived
Stream<DeeplinkDetails> get onDeeplinkReceivedA stream that emits deep link details when the app is opened from a Grovs link.
Methods
setDebugLevel
Future<void> setDebugLevel(String level)Set the debug logging level for native SDK messages. Options: 'info', 'error'.
setPushToken
Future<void> setPushToken(String token)Set the device push notification token (FCM or APNs) for receiving dashboard messages.
setUserIdentifier
Future<void> setUserIdentifier(String identifier)Set the user identifier. This value appears in the Grovs dashboard and reports. Typically set to your app's user_id.
setUserAttributes
Future<void> setUserAttributes(Map<String, dynamic> attributes)Set user attributes for identification and behavior analysis in the dashboard.
generateLink
Future<String> generateLink(GenerateLinkParams params)Generate a smart link with the specified parameters. Returns the generated URL string. Throws GrovsException on failure.
logInAppPurchase
Future<void> logInAppPurchase(String transactionId)Log a platform store purchase for revenue attribution. On iOS, pass the StoreKit transaction ID as a string. On Android, pass the purchase originalJson. Duplicates are filtered automatically.
logCustomPurchase
Future<void> logCustomPurchase({
required TransactionType type,
required int priceInCents,
required String currency,
required String productId,
DateTime? startDate,
})Log a custom purchase, cancellation, or refund for revenue tracking. Use for non-store payments (Stripe, PayPal, etc.).
Types
DeeplinkDetails
class DeeplinkDetails {
final String? link;
final Map<String, dynamic>? data;
final TrackingParams? tracking;
}Contains information about a received deep link.
| Property | Type | Description |
|---|---|---|
link | String? | The deep link URL that opened the app. |
data | Map<String, dynamic>? | Custom payload data attached to the link. |
tracking | TrackingParams? | Attribution and tracking metadata. |
GenerateLinkParams
class GenerateLinkParams {
final String title;
final String? subtitle;
final String? imageURL;
final Map<String, dynamic>? data;
final List<String>? tags;
final CustomRedirects? customRedirects;
final bool? showPreviewIos;
final bool? showPreviewAndroid;
final TrackingParams? tracking;
}Parameters for generating a smart link via generateLink.
| Parameter | Type | Description |
|---|---|---|
title | String | Link preview title (required). |
subtitle | String? | Link preview subtitle. |
imageURL | String? | Link preview image URL. |
data | Map<String, dynamic>? | Custom payload delivered on deep link open. |
tags | List<String>? | Tags for filtering and analytics. |
customRedirects | CustomRedirects? | Per-platform redirect overrides. |
showPreviewIos | bool? | Show link preview on iOS. |
showPreviewAndroid | bool? | Show link preview on Android. |
tracking | TrackingParams? | UTM tracking parameters. |
TrackingParams
class TrackingParams {
final String? utmCampaign;
final String? utmSource;
final String? utmMedium;
}UTM tracking parameters for link generation and deep link attribution.
| Parameter | Description |
|---|---|
utmCampaign | Campaign name (e.g. 'spring_sale'). |
utmSource | Traffic source (e.g. 'in_app'). |
utmMedium | Marketing medium (e.g. 'share_button'). |
CustomRedirects
class CustomRedirects {
final CustomLinkRedirect? ios;
final CustomLinkRedirect? android;
final CustomLinkRedirect? desktop;
}Override the default redirect behavior per platform when generating a link.
CustomLinkRedirect
class CustomLinkRedirect {
final String url;
final bool openAppIfInstalled; // default: true
}A platform-specific redirect. When openAppIfInstalled is true, the app opens if installed; otherwise the url is always used.
TransactionType
enum TransactionType {
buy,
cancel,
refund,
}The type of payment transaction. Used with logCustomPurchase.
| Value | Description |
|---|---|
buy | A new purchase. |
cancel | A cancelled subscription or purchase. |
refund | A refunded transaction. |
GrovsException
class GrovsException implements Exception {
final String message;
final String? code;
}Thrown when an SDK operation fails (e.g. generateLink).