Platforms and setup
Native platforms: ios, android.
Public actions
YouTube.open
factory YouTube.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 |
YouTube.openVideo
static YouTubeOpenVideoAction openVideo({ required final String videoId, 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 |
|---|---|---|---|
videoId | String | Yes | — |
fallbackToStore | bool | No | false |
YouTube.openChannel
static YouTubeOpenChannelAction openChannel({ required final String channelId, 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 |
|---|---|---|---|
channelId | String | Yes | — |
fallbackToStore | bool | No | false |
YouTube.openPlaylist
static YouTubeOpenPlaylistAction openPlaylist({ required final String playlistId, 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 |
|---|---|---|---|
playlistId | String | Yes | — |
fallbackToStore | bool | No | false |
YouTube.search
static YouTubeSearchAction 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 |
Provider setup and examples
DeeplinkX provides comprehensive support for YouTube deep linking actions.
Available Actions
Launch YouTube App
final deeplinkX = DeeplinkX();
// Simple launch
await deeplinkX.launchApp(YouTube.open());
// Launch with store fallback if not installed
await deeplinkX.launchApp(YouTube.open(fallbackToStore: true));
// Launch with fallback disabled
await deeplinkX.launchApp(YouTube.open(), disableFallback: true);
Open Video Action
final deeplinkX = DeeplinkX();
// Simple action
await deeplinkX.launchAction(YouTube.openVideo(videoId: 'dQw4w9WgXcQ')); // YouTube video ID
// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.openVideo(
videoId: 'dQw4w9WgXcQ', // YouTube video ID
fallbackToStore: true,
));
// Action with fallback disabled
await deeplinkX.launchAction(
YouTube.openVideo(videoId: 'dQw4w9WgXcQ'), // YouTube video ID
disableFallback: true,
);
Open Channel Action
final deeplinkX = DeeplinkX();
// Simple action
await deeplinkX.launchAction(YouTube.openChannel(channelId: 'UCq-Fj5jknLsUf-MWSy4_brA')); // YouTube channel ID
// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.openChannel(
channelId: 'UCq-Fj5jknLsUf-MWSy4_brA', // YouTube channel ID
fallbackToStore: true,
));
// Action with fallback disabled
await deeplinkX.launchAction(
YouTube.openChannel(channelId: 'UCq-Fj5jknLsUf-MWSy4_brA'), // YouTube channel ID
disableFallback: true,
);
Open Playlist Action
final deeplinkX = DeeplinkX();
// Simple action
await deeplinkX.launchAction(YouTube.openPlaylist(playlistId: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI')); // YouTube playlist ID
// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.openPlaylist(
playlistId: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI', // YouTube playlist ID
fallbackToStore: true,
));
// Action with fallback disabled
await deeplinkX.launchAction(
YouTube.openPlaylist(playlistId: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI'), // YouTube playlist ID
disableFallback: true,
);
Search Action
final deeplinkX = DeeplinkX();
// Simple action
await deeplinkX.launchAction(YouTube.search(query: 'flutter tutorial')); // Search query
// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.search(
query: 'flutter tutorial', // Search query
fallbackToStore: true,
));
// Action with fallback disabled
await deeplinkX.launchAction(
YouTube.search(query: 'flutter tutorial'), // Search query
disableFallback: true,
);
Required Permissions
Android
To check if YouTube is installed on Android, add the following to your AndroidManifest.xml:
<queries>
<package android:name="com.google.android.youtube" />
</queries>
Scheme Configuration
iOS
To handle YouTube deeplinks on iOS, add the following to your Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>youtube</string>
</array>
Supported Fallback Stores
When the YouTube app is not installed, DeeplinkX can redirect users to download YouTube from the following app stores:
- iOS App Store
- Google Play Store
Fallback Behavior
DeeplinkX follows this sequence when handling YouTube deeplinks:
- First, it attempts to launch the YouTube app if it's installed on the device.
- If the YouTube app is not installed and
fallbackToStoreis set totrue, it will redirect to the appropriate app store based on the user's platform (iOS App Store or Google Play Store). - If no supported store is available for the current platform or the store app cannot be launched, it will fall back to opening the YouTube web interface in the default browser.
- You can disable all fallbacks by setting
disableFallback: truein the launch methods.
Check If YouTube Is Installed
final deeplinkX = DeeplinkX();
final isInstalled = await deeplinkX.isAppInstalled(YouTube());