Build & Test codecov License: Apache 2.0

Flutter's Native Linkify

Example screenshot

native_linkify is a Flutter plugin. Use it to find links in plain-text.

The plugin uses NSDataDetector for iOS and macOS; Linkify for Android. This means the plugin finds links in the same way most native apps do, giving much more accurate results than existing pure dart packages.

This plugin doesn't have any widgets to show inline links out of the box, but it has everything you need to create them in a way you like.

Here's example which shows how to implement widget that's turns text URLs, E-Mails and phones into clickable links:

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

import 'package:url_launcher/url_launcher.dart';
import 'package:native_linkify/native_linkify.dart';

void main() async {
  final entries = await NativeLinkify.linkify(
      'text and +79990000000');
  // Note that this method is asynchronous because the plugin works with native
  // functions via MethodChannel and MethodChannel works only in asynchronous way
  // in real app it's better to linkify text at the place where you load it from
  // your data source
      entries: entries,

class MyApp extends StatelessWidget {
  const MyApp({Key? key, required this.entries}) : super(key: key);

  final List<LinkifyEntry> entries;

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
              children: [
                for (final l in entries)
                  if (l is LinkifyText)
                    // Regular text, text without links
                      text: l.text,
                  else if (l is LinkifyUrl)
                    // Link
                      text: l.text,
                      style: const TextStyle(color:,
                      recognizer: TapGestureRecognizer()
                        ..onTap = () => launch(l.url),