dartpub.dev DartNative · beta
plugins / dartnative_url_launcher
du

dartnative_url_launcher

v1.0.0 dartpub Free

Open links and deep links

The native URL launcher for DartNative — open web links, `mailto:`, `tel:`, `sms:`, and app deep links with the familiar `launch` / `canLaunch` API, plus a smart opener that routes YouTube, Maps, Spotify and more straight to their app.

by DartNative/dartnative_url_launcher · DartNative ≥ 3.0 · updated 3 weeks ago
Install
Free
pubspec.yaml
dependencies:
  dartnative_url_launcher: ^1.0.0
Weekly installs
38
Active apps
8
Rating
0.0 · 0
Open issues
0

dartnative_url_launcher

Open URLs from DartNative — web links, mailto:, tel:, sms:, and deep links into other apps. A familiar launch / canLaunch API, plus a smart opener that routes common services (YouTube, Maps, Spotify, …) straight to their app when it's installed. iOS and Android, one API.

Why you'll like it

  • Smart app-routingUrlLauncherHelper.open(url) opens the native app (YouTube, Maps, Spotify, Amazon, social) when present, and falls back to the browser.
  • Familiar APIlaunch / canLaunch, like Flutter's url_launcher.
  • iOS + Android — one Dart API for both.

Highlights

  • DartNativeUrlLauncher.launch(url) — open a URL in the default app; returns success.
  • DartNativeUrlLauncher.canLaunch(url) — is there an app that can handle it?
  • UrlLauncherHelper.open(url) — smart opener: native-app-first with browser fallback, returns (success, note) telling you which path it took.

Install

dependencies:
  dartnative_url_launcher: ^1.0.0   # from dartpub.dev
dn pub get
void main() {
  DartNativePluginRegistrant.registerAll();
  runApp(const MyApp());
}

Quick look

import 'package:dartnative_url_launcher/dartnative_url_launcher.dart';

Open a link:

await DartNativeUrlLauncher.launch('https://dartnative.com');
await DartNativeUrlLauncher.launch('mailto:[email protected]?subject=Hello');
await DartNativeUrlLauncher.launch('tel:+15551234567');

Check first:

if (DartNativeUrlLauncher.canLaunch('sms:+15551234567')) {
  await DartNativeUrlLauncher.launch('sms:+15551234567');
}

Smart open — routes to the app, falls back to the browser:

final (ok, note) = await UrlLauncherHelper.open('https://youtu.be/dQw4w9WgXcQ');
print(note); // "YouTube app"  or  "browser (YouTube app not installed)"

Platform setup

iOS

canLaunch can only see custom app schemes you declare in ios/Runner/Info.plist. http, https, mailto, tel, and sms need nothing; the smart opener's app schemes do:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>youtube</string>
  <string>comgooglemaps</string>
  <string>amazon</string>
</array>

Android

On Android 11+ (API 30), declare the schemes you open in android/app/src/main/AndroidManifest.xml so canLaunch can resolve them:

<queries>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="https" />
  </intent>
  <!-- add tel / mailto / sms / custom schemes as needed -->
</queries>

Example

The example/ app opens web, mail, tel, and a few app deep links — borrow from it freely.

Credits & license

Adapted from Flutter's url_launcher (BSD-3-Clause) — reworked to FFI, with the smart app-router added.

Commercial plugin distributed via dartpub.dev — file issues on the plugin's page.