Skip to main content

This documentation covers apliko_link 0.1.0 for Flutter.

Installation

Add the package to your pubspec.yaml:

yaml
dependencies:
  apliko_link: ^0.1.0

or run flutter pub add apliko_link.

The plugin includes native Android and iOS code, so do a full rebuild after adding it (stop the app, then build and run again). A hot restart does not load native code.

Your Android and iOS projects also need to be configured to open your links. See Platform Setup.

Quick Start

Mandatory

Call AplikoLink.init once, before runApp, with your client API key. Until then, every other SDK method throws a StateError ([AplikoLinkManager] Please call init() first); getInitialUrlAsync() and shouldOfferPaste() return a failed future instead.

dart
import 'package:apliko_link/apliko_link.dart';
import 'package:flutter/widgets.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  AplikoLink.init('cl_live_…');
  AplikoLink.addListener((String url, Map<String, dynamic> data, LinkEventMeta meta) {
    // meta.source: LinkSource.initial, .runtime or .deferred
    router.open(url, data);
  });

  runApp(const MyApp());
}

init options

OptionTypeDescription
apiKey*String (positional)Your client API key. Whitespace is trimmed; an empty key throws ArgumentError.
debugboolLogs what the SDK is doing. Defaults to false. See Debugging.
enableDeferredEnableDeferred?Deferred deep links. Android is on and iOS is off by default; always off on web and desktop. See Deferred Links.
webRuntimeLinksboolWeb only. Also reports Back/Forward and #fragment changes as runtime links. Defaults to false.

Call init once. Later calls are ignored until destroy().

Need a Client API Key?

Client API keys are generated for each project in the Hub. Use cl_test_… keys (Sandbox Hub) while developing and cl_live_… keys (Production Hub) for your released app. Never put a server key (sv_…) in your app; the SDK refuses to send one.