Docs

API Reference

Complete Flutter SDK properties and methods reference

Properties

onDeeplinkReceived

Dart
Stream<DeeplinkDetails> get onDeeplinkReceived

A stream that emits deep link details when the app is opened from a Grovs link.


Methods

setDebugLevel

Dart
Future<void> setDebugLevel(String level)

Set the debug logging level for native SDK messages. Options: 'info', 'error'.

setPushToken

Dart
Future<void> setPushToken(String token)

Set the device push notification token (FCM or APNs) for receiving dashboard messages.

setUserIdentifier

Dart
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

Dart
Future<void> setUserAttributes(Map<String, dynamic> attributes)

Set user attributes for identification and behavior analysis in the dashboard.

Dart
Future<String> generateLink(GenerateLinkParams params)

Generate a smart link with the specified parameters. Returns the generated URL string. Throws GrovsException on failure.

logInAppPurchase

Dart
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

Dart
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

Dart
class DeeplinkDetails {
  final String? link;
  final Map<String, dynamic>? data;
  final TrackingParams? tracking;
}

Contains information about a received deep link.

PropertyTypeDescription
linkString?The deep link URL that opened the app.
dataMap<String, dynamic>?Custom payload data attached to the link.
trackingTrackingParams?Attribution and tracking metadata.

GenerateLinkParams

Dart
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.

ParameterTypeDescription
titleStringLink preview title (required).
subtitleString?Link preview subtitle.
imageURLString?Link preview image URL.
dataMap<String, dynamic>?Custom payload delivered on deep link open.
tagsList<String>?Tags for filtering and analytics.
customRedirectsCustomRedirects?Per-platform redirect overrides.
showPreviewIosbool?Show link preview on iOS.
showPreviewAndroidbool?Show link preview on Android.
trackingTrackingParams?UTM tracking parameters.

TrackingParams

Dart
class TrackingParams {
  final String? utmCampaign;
  final String? utmSource;
  final String? utmMedium;
}

UTM tracking parameters for link generation and deep link attribution.

ParameterDescription
utmCampaignCampaign name (e.g. 'spring_sale').
utmSourceTraffic source (e.g. 'in_app').
utmMediumMarketing medium (e.g. 'share_button').

CustomRedirects

Dart
class CustomRedirects {
  final CustomLinkRedirect? ios;
  final CustomLinkRedirect? android;
  final CustomLinkRedirect? desktop;
}

Override the default redirect behavior per platform when generating a link.

CustomLinkRedirect

Dart
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

Dart
enum TransactionType {
  buy,
  cancel,
  refund,
}

The type of payment transaction. Used with logCustomPurchase.

ValueDescription
buyA new purchase.
cancelA cancelled subscription or purchase.
refundA refunded transaction.

GrovsException

Dart
class GrovsException implements Exception {
  final String message;
  final String? code;
}

Thrown when an SDK operation fails (e.g. generateLink).