LinkSniffer class

Matches URLs.

By default only unambiguous links are matched: those with an explicit scheme (https://…, ftp://…, …) or starting with www.. This avoids false positives on plain words like example.com or file names.

To restore the older permissive behavior (any word.tld-looking token), pass LinkSniffer.loosePattern as the pattern:

LinkSniffer(pattern: LinkSniffer.loosePattern)
Inheritance

Constructors

LinkSniffer({TextStyle? style, TextStyle? hoverStyle, RegExp? pattern})
Creates a link sniffer, optionally overriding the default style, hoverStyle or pattern.

Properties

hashCode int
The hash code for this object.
no setterinherited
hoverStyle TextStyle?
The style merged into style while the pointer hovers over a match (web/desktop). When null, matches have no hover effect.
no setterinherited
pattern RegExp?
The regular expression used to find matches. A null or empty pattern never matches.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style TextStyle?
The style applied to text matched by this sniffer.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

loosePattern RegExp
A permissive pattern that also matches scheme-less hosts such as example.com. Prone to false positives; opt in only if you need it.
final