Docs

Link Creation

Generate smart links programmatically in your Flutter app

Use generateLink to create a smart link with optional metadata, tracking, and redirects:

Dart
import 'package:grovs_flutter_plugin/grovs.dart';
import 'package:grovs_flutter_plugin/models/grovs_link.dart';
 
final grovs = Grovs();
 
Future<String> createShareLink() async {
  try {
    final link = await grovs.generateLink(
      GenerateLinkParams(
        title: 'Check out this product',
        subtitle: 'Limited time offer',
        imageURL: 'https://example.com/image.jpg',
        data: {
          'screen': 'product',
          'productId': '12345',
        },
        tags: ['promotion', 'share'],
        tracking: TrackingParams(
          utmCampaign: 'spring_sale',
          utmSource: 'in_app',
          utmMedium: 'share_button',
        ),
      ),
    );
 
    print('Generated: $link');
    return link;
  } on GrovsException catch (e) {
    print('Error: ${e.message}');
    rethrow;
  }
}

Custom redirects

Override where a link sends users on each platform:

Dart
final link = await grovs.generateLink(
  GenerateLinkParams(
    title: 'Special offer',
    data: {'promoId': 'summer25'},
    customRedirects: CustomRedirects(
      ios: CustomLinkRedirect(url: 'https://example.com/ios-promo'),
      android: CustomLinkRedirect(url: 'https://example.com/android-promo'),
      desktop: CustomLinkRedirect(url: 'https://example.com/desktop-promo', openAppIfInstalled: false),
    ),
  ),
);

Share dialog

Launch the platform share sheet after generating a link:

Dart
import 'package:share_plus/share_plus.dart';
 
final link = await grovs.generateLink(
  GenerateLinkParams(title: 'Share this', data: {'itemId': 'abc'}),
);
Share.share(link);

Parameters

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
trackingTrackingParams?UTM tracking parameters
customRedirectsCustomRedirects?Override default redirect behavior per platform
showPreviewIosbool?Show link preview on iOS (uses dashboard default if null)
showPreviewAndroidbool?Show link preview on Android (uses dashboard default if null)