Skip to main content

linksapp 0.1.0 copy "linksapp: ^0.1.0" to clipboard
linksapp: ^0.1.0 copied to clipboard

Flutter Universal Link and App Link handling for LinksApp.

LinksApp Flutter SDK #

One Flutter package for receiving and resolving verified LinksApp URLs. It uses app_links for OS delivery and its built-in LinksAppClient for HTTPS resolution. It is not published to pub.dev yet. Configure native Android App Links and iOS Universal Links before using it.

Because this adapter uses app_links, disable Flutter's default deep-link handler in the consuming app to avoid both handlers processing the same URL:

<!-- android/app/src/main/AndroidManifest.xml, inside MainActivity -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
<!-- ios/Runner/Info.plist, inside dict -->
<key>FlutterDeepLinkingEnabled</key>
<false/>
dependencies:
  linksapp:
    path: ../linkcard/packages/linksapp

Adjust the path to your checkout. Start the listener once near your app router:

import 'package:linksapp/linksapp.dart';

late final LinksAppFlutter linksApp;

Future<void> startLinks() async {
  linksApp = LinksAppFlutter(
    appKey: 'your-app-key',
    onResolved: (result) {
      // Route inside your app; never put the server-side sublink API key here.
      router.open(result.deepLink, referral: result.ref);
    },
    onError: (error, stack) {
      // 404 = unknown; 410 = disabled, expired, or exhausted.
      logger.warning('Could not open app link', error, stack);
    },
  );
  await linksApp.start();
}

Future<void> stopLinks() => linksApp.dispose();

start() handles the initial URL and later URLs, and suppresses the common duplicate initial event. Call dispose() when the owning router is torn down. The required app key prevents this app from resolving another customer's link. The SDK does not claim a domain or automatically restore an iOS link after a first-time App Store install.

If your app receives URLs through another mechanism, use the resolver directly:

final client = LinksAppClient(expectedAppKey: 'your-app-key');
try {
  final result = await client.resolve(incomingUri);
  router.open(result.deepLink, referral: result.ref);
} finally {
  client.close();
}

resolve raises FormatException for malformed URLs or responses and LinksAppException for API errors such as 404 and 410. Keep the per-app sublink creation API key on a trusted server, not in your mobile app.

0
likes
0
points
133
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Universal Link and App Link handling for LinksApp.

Homepage

License

unknown (license)

Dependencies

app_links, flutter, http

More

Packages that depend on linksapp