protocol_handler
0.3.0, released 9 days ago by leanflutter.dev
Register and handle custom protocols and deep links in Flutter apps.
What it does
Allows Flutter apps to register custom URL schemes and handle incoming protocol URLs across Android, iOS, macOS, and Windows. It provides event listeners for protocol URLs received while the app is running and supports getting initial URLs.
AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to handle custom URL schemes or deep links in a desktop or mobile Flutter app
- You want to forward protocol launch URLs from secondary app instances to a running instance on Windows
Skip it when
- You only need standard web URL routing without custom protocol handlers
- You are targeting Linux (not supported)
Strengths
- Cross-platform support covering Android, iOS, macOS, and Windows
- Queues URLs that arrive before a listener is attached
- Provides initial URL retrieval and event listeners
Weaknesses
- Requires manual configuration in platform-specific files such as AndroidManifest.xml, Info.plist, and main.cpp
- Linux is not supported
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 1
Requires native configuration including intent filters on Android, CFBundleURLTypes in Info.plist for iOS and macOS, and wWinMain modifications for Windows.
import 'package:protocol_handler/protocol_handler.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await protocolHandler.register('myprotocol');
runApp(MyApp());
}Alternatives
Packages that do the same job and could replace protocol_handler.
Works with
Packages commonly used together with protocol_handler: ones it builds on, ones built on it, and its own family.
- nativeapiprotocol_handler depends on itDart bindings to native system APIs across desktop and mobile
- screen_retrieverSame familyRead desktop screen size, work area, scale factor and cursor position on Windows, macOS and Linux.
- window_managerSame familyFlutter desktop window resizing, moving, showing, hiding via nativeapi.
- tray_managerSame familyDefine system tray icons and context menus in Flutter desktop apps.
- hotkey_managerSame familyRegister system-wide and in-app keyboard shortcuts on desktop and Android
- nativeapi_flutterSame familyFlutter integration for nativeapi, adding widgets and type conversions.