# Threads

Canonical HTML: https://p-hatan.com/deeplink-x/apps/threads/

DeeplinkX 1.5.8.

## Platforms and setup

Native platforms: **ios, android**.



## Public actions

### Threads.open


```dart
factory Threads.open({final bool fallbackToStore = false})
```

Launch with `DeeplinkX.launchApp`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L22)

### Threads.openProfile


```dart
static ThreadsOpenProfileAction openProfile({ required final String username, final bool fallbackToStore = false, })
```

Launch with `DeeplinkX.launchAction`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `username` | `String` | Yes | — |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L59)

### Threads.openPost


```dart
static ThreadsOpenPostAction openPost({ required final String username, required final String postId, final bool fallbackToStore = false, })
```

Launch with `DeeplinkX.launchAction`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `username` | `String` | Yes | — |
| `postId` | `String` | Yes | — |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L69)

### Threads.openComments


```dart
static ThreadsOpenCommentsAction openComments({ required final String username, required final String postId, final bool fallbackToStore = false, })
```

Launch with `DeeplinkX.launchAction`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `username` | `String` | Yes | — |
| `postId` | `String` | Yes | — |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L84)

### Threads.createPost


```dart
static ThreadsCreatePostAction createPost({ required final String text, final bool fallbackToStore = false, })
```

Launch with `DeeplinkX.launchAction`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `text` | `String` | Yes | — |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L96)

### Threads.search


```dart
static ThreadsSearchAction search({ required final String query, final bool fallbackToStore = false, })
```

Launch with `DeeplinkX.launchAction`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `query` | `String` | Yes | — |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L106)

### Threads.openTag


```dart
static ThreadsOpenTagAction openTag({ required final String tag, final bool fallbackToStore = false, })
```

Launch with `DeeplinkX.launchAction`. Native platforms: **ios, android**. Action web fallback: **available**. Store-fallback flag: **supported; opt in explicitly**.

| Parameter | Type | Required | Default |
| --- | --- | --- | --- |
| `tag` | `String` | Yes | — |
| `fallbackToStore` | `bool` | No | `false` |

[Exact source](https://github.com/DeepLinkX/DeeplinkX/blob/00d9d2c7c1affe4e2ee459a01afeba82a1480eac/lib/src/apps/downloadable_apps/threads.dart#L116)


## Provider setup and examples
DeeplinkX provides support for Threads deep linking actions on Android and iOS, with web fallback available on all platforms.

## Available Actions

### Launch Threads App
```dart
final deeplinkX = DeeplinkX();

await deeplinkX.launchApp(Threads.open());
await deeplinkX.launchApp(Threads.open(fallbackToStore: true));
await deeplinkX.launchApp(Threads.open(), disableFallback: true);
```

### Open Profile Action
```dart
final deeplinkX = DeeplinkX();

await deeplinkX.launchAction(Threads.openProfile(username: 'zuck'));

await deeplinkX.launchAction(Threads.openProfile(
  username: 'zuck',
  fallbackToStore: true,
));

await deeplinkX.launchAction(
  Threads.openProfile(username: 'zuck'),
  disableFallback: true,
);
```

### Open Post Action
```dart
final deeplinkX = DeeplinkX();

await deeplinkX.launchAction(Threads.openPost(
  username: 'zuck',
  postId: 'CuN0hdYv8Lq',
));
```

### Open Comments Action
```dart
final deeplinkX = DeeplinkX();

await deeplinkX.launchAction(Threads.openComments(
  username: 'zuck',
  postId: 'CuN0hdYv8Lq',
));
```

Threads surfaces replies on the post permalink, so `openComments` intentionally targets the same URL as `openPost`.

### Create Post Action
```dart
final deeplinkX = DeeplinkX();

await deeplinkX.launchAction(Threads.createPost(text: 'Hello from Threads'));

await deeplinkX.launchAction(Threads.createPost(
  text: 'Hello from Threads',
  fallbackToStore: true,
));
```

### Search Action

```dart
await deeplinkX.launchAction(
  Threads.search(query: 'flutter'),
);
```

### Open Topic Tag Action

```dart
await deeplinkX.launchAction(
  Threads.openTag(tag: 'flutter'),
);
```

Search queries and topic tags must not be blank. DeeplinkX URI-encodes the
supplied value without trimming or otherwise rewriting it.

## Platform-Specific Configuration

### iOS
Add the following to your `ios/Runner/Info.plist`:
```xml
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>barcelona</string>
    <string>itms-apps</string>
</array>
```

### Android
Add the following to your `android/app/src/main/AndroidManifest.xml` inside the `<queries>` tag:
```xml
<queries>
    <!-- For Threads app -->
    <package android:name="com.instagram.barcelona" />

    <!-- For Play Store fallback (if using fallbackToStore) -->
    <package android:name="com.android.vending" />

    <!-- For permalink and web intent fallback -->
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
    </intent>

    <!-- For native Threads scheme fallback -->
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="barcelona" />
    </intent>
</queries>
```

## URL Schemes

DeeplinkX uses the following URLs for Threads:

### Native App Deep Links
- `barcelona://user?username={username}` for profile native fallback
- `barcelona://media?shortcode={postId}` for post/comments native fallback
- `barcelona://create?text={text}` for compose native fallback
- `barcelona://search?search_text={query}` for search
- `barcelona://tag/{tag}` for topic tags
- package-targeted Android intents for:
  - profile permalinks
  - post permalinks
  - compose/share text with `android.intent.action.SEND`

### Web Fallback URLs
- `https://www.threads.com/@{username}`
- `https://www.threads.com/@{username}/post/{postId}`
- `https://www.threads.com/intent/post?text={text}`
- `https://www.threads.com/search?q={query}`
- `https://www.threads.com/tag/{tag}`

## Supported Fallback Stores

When Threads is not installed, DeeplinkX can redirect users to:

- iOS App Store
- Google Play Store

## Notes

- On Android, DeeplinkX first launches package-targeted Threads intents backed by Threads App Links metadata, then tries the native `barcelona://` scheme when available before using web or store fallback.
- The `barcelona://` scheme is not vendor-documented. DeeplinkX pairs it with web fallbacks so profile, post, and compose flows still resolve somewhere useful if the scheme changes.
- Search and topic tags are included because their native destinations passed
  physical Android verification and have matching public web destinations.
- Internal feed, messaging, followers, settings, and debug handlers are not
  exposed.

## Check If Threads Is Installed

```dart
final deeplinkX = DeeplinkX();
final isInstalled = await deeplinkX.isAppInstalled(Threads());
```

