linkify 2.0.3

linkify pub package

Low-level link (text, URLs, emails) parsing library in Dart.

Flutter library.

Pub - API Docs - GitHub

Install #

Install by adding this package to your pubspec.yaml:

  linkify: ^2.0.3

Usage #

import 'package:linkify/linkify.dart';

linkify("Made by");
// Output: [TextElement: 'Made by ', UrlElement: '' (, TextElement: ' ', EmailElement: '' (]

Options #

You can pass LinkifyOptions to the linkify method to change the humanization of URLs (turning to

// [UrlElement: '' (]

linkify("", options: LinkifyOptions(humanize: false));
// [UrlElement: '' (]

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")] would become [TextElement("Hello "), UrlElement("")]
  • Each parsers is ran in order of how they are passed to the main linkify function. By default, this is URL and email linkifiers

[2.0.3] - 2020-01-08

  • Fix more minor lint issues
  • Remove extra print

[2.0.2] - 2019-12-30

  • Fix minor lint issues

[2.0.1] - 2019-12-27

  • Export defaultLinkifiers

[2.0.0] - 2019-12-27

  • Change LinkTypes to Linkifier
    • Supports custom linkifiers
  • Change LinkElement to UrlElement to better reflect UrlLinkifier (link != URL)
  • Change humanize option to LinkifyOptions
  • Enabled humanize by default

[1.0.1] - 2019-03-23

  • Republish to fix maintenance score

[1.0.0] - 2019-03-23

  • Initial release


import 'package:linkify/linkify.dart';

void main() {
  print(linkify("Made by"));
  // Output: [TextElement: 'Made by ', UrlElement: '' (, TextElement: ' ', EmailElement: '' (]

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  linkify: ^2.0.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:linkify/linkify.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
collection ^1.0.0
pedantic ^1.0.0
test ^1.0.0