Search packages, repositories and app categories

flutter_linkify cover
Package detailsv6.0.0

flutter_linkify

Turns text URLs and emails into clickable inline links in text for Flutter.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
284K
Likes
775
Pub points
150

Install package

flutter pub add flutter_linkify

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

flutter_linkify is a Flutter package that automatically detects URLs and email addresses in plain text and converts them into clickable links. It enhances text rendering by enabling inline hyperlinks without requiring manual formatting. The package supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for cross-platform applications. It integrates seamlessly with Flutter's Text widget and offers customizable link styles and behaviors.

Use cases

  • Converting raw text with URLs into interactive links
  • Displaying emails as mailto: links
  • Enhancing user experience in chat or comment sections
  • Creating rich text content with automatic linking
  • Building documentation or help screens with clickable references

Key features

  • Automatic detection of URLs and emails
  • Support for multiple platforms
  • Customizable link styling
  • Integration with Flutter's Text widget
  • Configurable link behavior and callbacks
  • Handles both http and https protocols

Suitable for

  • Apps needing rich text with clickable links
  • Chat or messaging interfaces
  • Documentation or knowledge base apps
  • Content-heavy applications with user-generated text
  • Developers seeking easy hyperlink integration

Considerations

  • May require additional styling for consistent appearance
  • Potential performance impact with large text blocks
  • Limited to URL and email patterns (not custom regex)
  • Requires careful handling of link tap events
  • Not suitable for complex rich text formatting beyond links

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_linkify pub package

Turns text URLs and emails into clickable inline links in text for Flutter.

Required Dart >=2.17 (has null-safety support).

Pub - API Docs - GitHub

Install

Install by adding this package to your pubspec.yaml:

dependencies:
  flutter_linkify: ^6.0.0

It is highly recommend that you also add a dependency on url_launcher to open links in the browser/OS.

Usage

Basic:

import 'package:flutter_linkify/flutter_linkify.dart';

Linkify(
  onOpen: (link) => print("Clicked ${link.url}!"),
  text: "Made by https://cretezy.com",
);
Styling

Add a style to non-links (yellow) or links (red), and open in browser using url_launcher:

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

Linkify(
  onOpen: (link) async {
    if (!await launchUrl(Uri.parse(link.url))) {
      throw Exception('Could not launch ${link.url}');
    }
  },
  text: "Made by https://cretezy.com",
  style: TextStyle(color: Colors.yellow),
  linkStyle: TextStyle(color: Colors.red),
);

All RichText options are available for use.

Linkify Options

By default, humanization (removal of http:// or https:// from the start of the URL) is enabled. You may disable it by passing options:

Linkify(
  text: "Made by https://cretezy.com",
  options: LinkifyOptions(humanize: false),
);
Selectable Text

Use the SelectableLinkify widget to create selectable text. All SelectableText options are available for use.

SelectableLinkify(
  text: "Made by https://cretezy.com\n\nMail: example@gmail.com",
);
Advance

In the onOpen callback, a LinkableElement is passed in. You can check if it is a UrlElement or EmailElement using is for custom handling.

You can enable parsing of only some link types using the linkifiers option. URL and email are enabled by default.

Full example can be found at example/lib/main.dart.

Example Screenshot

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package