Search packages, repositories and app categories

Package detailsv5.0.0

linkify

Low-level link (text, URLs, emails, phone numbers, user tags) parsing library in Dart.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
390K
Likes
182
Pub points
150

Install package

flutter pub add linkify

Package Overview

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

Linkify is a low-level Dart library designed to parse text and identify links, URLs, email addresses, phone numbers, and user tags. It provides a lightweight and efficient way to detect and extract structured data from plain text across multiple platforms. Ideal for applications needing automated text processing, such as chat interfaces, social media feeds, or content rendering. The library supports Android, iOS, Web, macOS, Windows, and Linux, ensuring broad compatibility. It does not include UI components but focuses on accurate parsing, making it suitable for integration into custom widgets or text processors.

Use cases

  • Parsing user-generated content
  • Extracting URLs and emails from text
  • Building chat or messaging apps
  • Enhancing text display with clickable links
  • Processing social media posts
  • Automating contact information extraction

Key features

  • Supports URLs, emails, phone numbers, and user tags
  • Cross-platform compatibility
  • Lightweight and efficient parsing
  • No built-in UI components
  • High accuracy in pattern detection
  • Extensible for custom link types

Suitable for

  • Developers building text-heavy apps
  • Apps requiring automated link detection
  • Custom text processing pipelines
  • Chat or forum applications
  • Content rendering systems

Considerations

  • Does not provide visual rendering of links
  • Requires manual implementation of tap handling
  • Limited to basic text patterns
  • Not suitable for complex HTML parsing
  • No built-in styling options
  • Depends on external logic for interaction

Original README

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

linkify pub package

Low-level link (text, URLs, emails, phone numbers, user tags) parsing library in Dart.

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

Flutter library.

Pub - API Docs - GitHub

Install

Install by adding this package to your pubspec.yaml:

dependencies:
  linkify: ^5.0.0

Usage

import 'package:linkify/linkify.dart';

linkify("Made by https://cretezy.com person@example.com");
// Output: [TextElement: 'Made by ', UrlElement: 'https://cretezy.com' (cretezy.com), TextElement: ' ', EmailElement: 'person@example.com' (person@example.com)]
Options

You can pass LinkifyOptions to the linkify method to change the humanization of URLs (turning https://example.com to example.com):

linkify("https://cretezy.com");
// [UrlElement: 'https://cretezy.com' (cretezy.com)]

linkify("https://cretezy.com", options: LinkifyOptions(humanize: false));
// [UrlElement: 'https://cretezy.com' (https://cretezy.com)]
  • humanize: Removes http/https from shown URLs
  • removeWww: Removes www. from shown URLs
  • looseUrl: Enables loose URL parsing (should parse most URLs such as abc.com/xyz)
    • defaultToHttps: When used with [looseUrl], default to https instead of http
  • excludeLastPeriod: Excludes . at end of URLs
Linkifiers

You can pass linkifiers to linkify as such:

linkify("@cretezy", linkifiers: [UserTagLinkifier()]);

Available linkifiers:

  • EmailLinkifier
  • UrlLinkifier
  • PhoneNumberLinkifier
  • UserTagLinkifier

Custom Linkifier

You can write custom linkifiers for phone numbers or other types of links. Look at the URL linkifier for an example.

This is the flow:

  • Calls parse in the linkifier with a list of LinkifyElement. This starts as [TextElement(text)]
  • Your parsers then splits each element into it's parts. For example, [TextElement("Hello https://example.com")] would become [TextElement("Hello "), UrlElement("https://example.com")]
  • Each parsers is ran in order of how they are passed to the main linkify function. By default, this is URL and email linkifiers

Categories

Source repository

Projects using this package