Skip to main content

SDK Installation (Flutter)

Detour provides a Flutter plugin (detour_flutter_plugin) that bridges native Detour SDK behavior on Android and iOS.

Beta

Flutter SDK docs version 1.0.1 is currently in beta. API and integration details may still change before stable release.

Before installation, make sure your app is created in the Detour Dashboard and you have:

  • appID from API configuration
  • publishable apiKey from API configuration
  • platform integration snippets from App configuration

Requirements

  • Flutter: >=3.3.0
  • Dart: ^3.11.1
  • Android min SDK: 24
  • iOS: 13.0+

Install package

Add the package to your pubspec.yaml:

dependencies:
detour_flutter_plugin: ^1.0.1

Then run:

flutter pub get

Native SDK dependencies

detour_flutter_plugin wraps native Detour SDKs:

  • Android bridge depends on com.swmansion.detour:detour-sdk:1.0.0.
  • iOS native Detour implementation is embedded in plugin sources (no extra pod to add manually).

For Android dependency resolution, keep google() and mavenCentral() in your project repositories.

For iOS integration updates, run:

cd ios
pod install
cd ..

App config

Use your credentials in DetourConfig:

const DetourConfig(
apiKey: '<REPLACE_WITH_YOUR_API_KEY>',
appID: '<REPLACE_WITH_APP_ID_FROM_PLATFORM>',
shouldUseClipboard: true,
linkProcessingMode: LinkProcessingMode.all,
)

Platform integration

The plugin handles bridge wiring, but your app still needs native deep-link setup:

  • Android:
    • App Links intent-filter from Dashboard
    • optional custom scheme intent-filter (if you use scheme links)
  • iOS:
    • Associated Domains (applinks:<domain>)
    • CFBundleURLTypes for custom scheme links
    • if you override AppDelegate/SceneDelegate deep-link callbacks, always forward to super

iOS delegate forwarding (required when overriding)

Flutter plugins (including Detour) receive lifecycle callbacks through Flutter delegate chain.
If you override iOS deep-link callbacks, return super result:

override func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return super.application(app, open: url, options: options)
}

override func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
return super.application(
application,
continue: userActivity,
restorationHandler: restorationHandler
)
}

Reference implementation:

note

On iOS 14+, clipboard matching uses detectPatterns before reading pasteboard content. Actual clipboard value is read only when probable URL is detected.

Next steps

  1. Integrate startup/runtime flow in SDK Usage.
  2. Start from the runnable app in Examples.