Flutter API Reference
The AplikoLink class, its types, EnableDeferred, the paste widgets and errors.
This documentation covers apliko_link 0.1.0 for Flutter.
AplikoLink
Everything is static on AplikoLink. Import it with package:apliko_link/apliko_link.dart.
| Member | Returns | Description |
|---|---|---|
init(String apiKey, {bool debug = false, EnableDeferred? enableDeferred, bool webRuntimeLinks = false}) | void | Starts the SDK. A second call is ignored until destroy(). An empty key throws ArgumentError. |
addListener(UrlCallback callback) | Unsubscribe | Adds a listener; call the result to remove it. |
removeAllListeners() | void | Removes every listener. |
getCurrentLink() | CurrentLink? | The latest delivered link with its data and source. Never used up; no request. |
getCurrentUrl() | String? | The latest runtime link received, else the pending one-time link. Set before delivery, so it can differ from getCurrentLink().url. Never used up. |
getInitialUrl() | String? | Takes the one-time link, so listeners won't get it. Null before startup has finished. |
getInitialUrlAsync() | Future<String?> | The same, but waits for startup. Null when there is none, after destroy(), or if no launch link arrives in time. |
getDataForUrl(String url) | Future<Map<String, dynamic>> | Link data of an Apliko link; {} for anything else. Never fails. |
getDeferredLinkResult() | DeferredLinkResult | This launch's deferred outcome: url, data, source, referrer, isAplikoLink. The empty result (url null, isAplikoLink false) until the check has finished; data only once the link reached a listener. |
shouldOfferPaste() | Future<bool> | iOS: whether to show the paste UI now. Always false elsewhere. |
destroy() | void | Stops the SDK. Synchronous. A deferred link is never delivered again after destroy() and init(). |
Types
dart
import 'package:apliko_link/apliko_link.dart';
typedef UrlCallback = void Function(
String url,
Map<String, dynamic> data,
LinkEventMeta meta,
);
typedef Unsubscribe = void Function();
enum LinkSource { initial, runtime, deferred }
class LinkEventMeta { final LinkSource source; }
class CurrentLink { final String url; final Map<String, dynamic> data; final LinkSource source; }
enum DeferredLinkSource { installReferrer, pasteButton }
class DeferredLinkResult {
final String? url;
final Map<String, dynamic>? data;
final DeferredLinkSource? source;
final String? referrer;
final bool isAplikoLink; // false by default
}
class EnableDeferred {
const EnableDeferred({bool? android, bool? ios});
const EnableDeferred.all(bool enabled);
}The paste widgets are AplikoPasteHost, AplikoPasteButton and AplikoPaste (show() / hide()), with the option types AplikoPasteButtonOptions, AplikoPasteMode, AplikoPastePresentation, AplikoPastePosition, AplikoPasteTrigger, AplikoPasteCornerStyle and AplikoPasteDisplayMode. Their props and defaults are listed under iOS Paste Widgets.
EnableDeferred
| Value | Android | iOS |
|---|---|---|
| omitted | on | off |
EnableDeferred.all(true) | on | on |
EnableDeferred.all(false) | off | off |
EnableDeferred(ios: true) | on (default) | on |
EnableDeferred(android: false, ios: true) | off | on |
Deferred links are always off on web and desktop.
Errors
- Any method called before
init()throwsStateErrorwith[AplikoLinkManager] Please call init() first.getInitialUrlAsync()andshouldOfferPaste()fail their future instead. - An empty
apiKeythrowsArgumentErrorwith[AplikoLinkManager] apiKey is required. - There is no error stream. Failures degrade gracefully: link data becomes
{}and a missing link becomesnull. Turn ondebugto see what happened.