Docs
grovs.io Start for free

Link creation

Generate smart links and read link details in your Flutter app.

Create smart links from your app with generateLink, and read an existing link with linkDetails.

Pass metadata, tracking and redirects. It returns the URL as a String:

Dart
import 'package:flutter/foundation.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',
        ),
      ),
    );
 
    debugPrint('Generated: $link');
    return link;
  } on GrovsException catch (e) {
    debugPrint('Error: ${e.message} (${e.code})');
    rethrow;
  }
}

The SDK must be configured, enabled and authenticated. Failures throw GrovsException with code GENERATION_ERROR. The message is the native error text on Android, a generic message on iOS.

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
customRedirectsCustomRedirects?Override the default redirect per platform. See Custom redirects
showPreviewIosbool?Show the link preview page on iOS. null uses the project default
showPreviewAndroidbool?Show the link preview page on Android. null uses the project default
copyToClipboardIosbool?Copy the link to the clipboard from the preview page on iOS, for clipboard-assisted deferred deep linking. null inherits the project setting
copyToClipboardAndroidbool?Same, for Android. null inherits the project setting
trackingTrackingParams?UTM campaign, source and medium

copyToClipboardIos and copyToClipboardAndroid apply only when that platform shows the preview page. Passing false is an explicit override, unlike omitting the parameter. Project setting and visitor experience: Copy to Clipboard.

On Android, data values that are strings, numbers, booleans or otherwise serializable pass through; anything else goes through toString(). iOS passes the map unchanged.

Custom redirects

Override where a link sends users per 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,
      ),
    ),
  ),
);

With openAppIfInstalled true (default), the app opens if installed, otherwise the redirect URL is used. With false, the redirect URL is always used.

Open the share sheet once the link is ready, for example with share_plus:

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

linkDetails fetches a link by its path, the last part of the link. For https://yourapp.sqd.link/abc123 the path is abc123. Pass the path only, not the full URL.

Dart
try {
  final details = await grovs.linkDetails('abc123');
  debugPrint('${details.title} ${details.data} ${details.tracking?.utmCampaign}');
} on GrovsException catch (e) {
  debugPrint('Error ${e.code}: ${e.message}');
}
GrovsException.codeRaised when
INVALID_ARGUMENTThe path is empty or only whitespace. Checked in Dart.
SDK_DISABLEDThe SDK is disabled with setSDK(false).
LINK_DETAILS_ERRORThe link wasn't found or the request failed.

The result is a GrovsLinkDetails. A field whose value has an unexpected type is null. raw holds every field the backend sent, as received; its numbers can be doubles on Android and ints on iOS, while the typed fields are the same on both platforms.

Next steps

Last updated 2026-10-27
Was this page helpful?