Skip to content
pubscout

protocol_handler

0.3.0, released 9 days ago by leanflutter.dev

Register and handle custom protocols and deep links in Flutter apps.

WASM-ready
$ flutter pub add protocol_handler
Source repository

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.

  • app_links

    Alternative library for handling deep links and app links across platforms.

Works with

Packages commonly used together with protocol_handler: ones it builds on, ones built on it, and its own family.