Package selection guidance compiled from public package information, community data, and project usage.
The protocol_handler package enables Flutter applications to register and respond to custom URL schemes, facilitating deep linking across platforms. It allows apps to handle external links (e.g., myapp://open) by launching the app and passing data through the URI. This is particularly useful for integrating with other apps, web services, or system-level triggers. The plugin supports Android, iOS, macOS, and Windows, making it ideal for cross-platform desktop and mobile apps that require seamless navigation from external sources.
Use cases
Handling custom URL schemes
Enabling deep linking from emails or websites
Integrating with third-party apps
Supporting desktop and mobile workflows
Launching app from external links
Key features
Cross-platform support
Custom protocol registration
URI data extraction
Simple API integration
Desktop and mobile compatibility
Suitable for
Apps needing deep linking
Desktop and mobile hybrid apps
External service integrations
App-to-app communication
Developers building universal links
Considerations
Requires platform-specific setup
May need additional configuration on iOS
Limited to supported platforms
Security considerations with URI handling
Not suitable for standard HTTP URLs
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.
protocol_handler
This plugin allows Flutter apps to register and handle custom protocols (i.e. deep linking).
Change the file android/app/src/main/AndroidManifest.xml as follows:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.leanflutter.plugins.protocol_handler_example">
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="protocol_handler_example">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
+ <intent-filter>+ <action android:name="android.intent.action.VIEW" />++ <category android:name="android.intent.category.DEFAULT" />+ <category android:name="android.intent.category.BROWSABLE" />+ <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->+ <data android:scheme="myprotocol" />+ </intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
import'package:protocol_handler/protocol_handler.dart';
voidmain() async {
// Must add this line.WidgetsFlutterBinding.ensureInitialized();
// Register a custom protocol// For macOS platform needs to declare the scheme in ios/Runner/Info.plistawait protocolHandler.register('myprotocol');
runApp(MyApp());
}