Docs

Link Creation

Generate smart links programmatically in your Flutter app

Use generateLink to create a smart link. All parameters except the callback are optional:

Dart
import 'package:grovs_flutter_plugin/grovs.dart';
import 'package:grovs_flutter_plugin/models/grovs_link.dart';
 
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',
        payload: {
          'screen': 'product',
          'productId': '12345',
        },
        tags: ['promotion', 'share'],
        tracking: TrackingParams(
          utmCampaign: 'spring_sale',
          utmSource: 'in_app',
          utmMedium: 'share_button',
        ),
        customRedirects: {
          'ios': 'https://custom-ios-redirect.com',
          'android': 'https://custom-android-redirect.com',
          'desktop': 'https://custom-desktop-redirect.com',
        },
      ),
    );
 
    print('Generated: $link');
    return link;
  } on GrovsException catch (e) {
    print('Error: ${e.message}');
    rethrow;
  }
}

Parameters

ParameterTypeDescription
titleString?Link preview title
subtitleString?Link preview subtitle
imageUrlString?Link preview image URL
payloadMap<String, dynamic>?Custom data delivered on deep link open
tagsList<String>?Tags for filtering and analytics
trackingTrackingParams?UTM tracking parameters
customRedirectsMap<String, String>?Override default redirect URLs per platform