सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
protocol_handler पैकेज फ्लटर एप्लिकेशन को कस्टम URL स्कीम के लिए पंजीकरण और प्रतिक्रिया करने की अनुमति देता है, जिससे प्लेटफॉर्म के बीच डीप लिंकिंग संभव होती है। यह ऐप्स को बाहरी लिंक (उदाहरण के लिए myapp://open) को संभालने में सक्षम बनाता है, जिसमें ऐप को लॉन्च करना और URI के माध्यम से डेटा पास करना शामिल है। यह अन्य ऐप्स, वेब सेवाओं या सिस्टम-स्तरीय ट्रिगर्स के साथ एकीकरण के लिए विशेष रूप से उपयोगी है। प्लगइन को एंड्रॉइड, आईओएस, मैकओएस और विंडोज के लिए समर्थन मिलता है, जिससे यह बाहरी स्रोतों से निरंतर नेविगेशन की आवश्यकता वाले क्रॉस-प्लेटफॉर्म डेस्कटॉप और मोबाइल ऐप्स के लिए आदर्श है।
उपयोग
कस्टम URL स्कीम का प्रबंधन
ईमेल या वेबसाइट से डीप लिंकिंग सक्षम करें
तीसरे पक्ष के ऐप्स के साथ एकीकरण
डेस्कटॉप और मोबाइल वर्कफ़्लो का समर्थन करता है
बाहरी लिंक से ऐप लॉन्च करना
मुख्य विशेषताएँ
प्लेटफॉर्म-समर्थन
कस्टम प्रोटोकॉल पंजीकरण
URI डेटा निकालना
सरल API एकीकरण
डेस्कटॉप और मोबाइल सुविधा
इनके लिए उपयुक्त
गहरे लिंकिंग की आवश्यकता वाले ऐप्स
डेस्कटॉप और मोबाइल हाइब्रिड ऐप्स
बाहरी सेवा एकीकरण
एप्प-टू-एप्प संचार
यूनिवर्सल लिंक्स बनाने वाले डेवलपर्स
विचार योग्य बातें
प्लेटफॉर्म-विशिष्ट सेटअप की आवश्यकता है
iOS पर अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता हो सकती है
समर्थित प्लेटफॉर्म तक सीमित
URI प्रबंधन में सुरक्षा पहलू
मानक HTTP URL के लिए उपयुक्त नहीं
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
🚀 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());
}