# Get started with DeeplinkX

Canonical HTML: https://p-hatan.com/deeplink-x/getting-started/

DeeplinkX 1.5.8.

### Install and import

```sh
flutter pub add deeplink_x
```

These examples use **DeeplinkX 1.5.8**. Add `deeplink_x: ^1.5.8` for compatible releases, or pin `1.5.8` for that exact version. The package requires Dart `>=3.1.0 <4.0.0` and Flutter `>=3.13.0`.

```dart
import 'package:deeplink_x/deeplink_x.dart';

final deeplinkX = DeeplinkX();

Future<bool> openTelegramProfile() => deeplinkX.launchAction(
  Telegram.openProfile(username: 'flutter', fallbackToStore: true),
);
```

This attempts the native profile action when detectable, then a configured matching store if enabled, then the action's web fallback if earlier paths fail. The returned Boolean reports final handoff success. The destination app handles the profile view.

### Configure only the apps/stores you use

On iOS, add the queried schemes to `ios/Runner/Info.plist`. For the Telegram example with an iOS App Store fallback:

```xml
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>tg</string>
    <string>itms-apps</string>
</array>
```

On Android, add `<queries>` as a direct child of `<manifest>`, alongside `<application>`, rather than inside `<application>`:

```xml
<queries>
    <package android:name="org.telegram.messenger" />
    <package android:name="com.android.vending" />
    <package android:name="com.huawei.appmarket" />
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
    </intent>
</queries>
```

Other providers can need their own `VIEW` intent-scheme queries. Read the matching app document and action source rather than copying every entry from the example manifest. For macOS, add the relevant query schemes to `macos/Runner/Info.plist` where required; for WhatsApp and its Mac store, these are `whatsapp` and `macappstore`. The package does not require equivalent query files on web, Windows, or Linux, but native detection, scheme handlers, browser policies, and fallback capabilities still differ.

### Launch an app, launch an action, check availability

```dart
Future<bool> openInstagram() => deeplinkX.launchApp(
  Instagram.open(fallbackToStore: true),
);

Future<bool> openWhatsAppChat() => deeplinkX.launchAction(
  WhatsApp.chat(
    phoneNumber: '1234567890', // Replace with the intended recipient.
    message: 'Hello!',
    fallbackToStore: true,
  ),
);

Future<bool> canOfferLinkedInNativeLaunch() =>
    deeplinkX.isAppInstalled(LinkedIn());
```

These examples do not send a message in the background. The external provider resolves the destination and the user completes any interaction it requires. Validate your application's user input and handle unsuccessful launches in its UI.

