getFirstLink method
Attempts to extract link from a string.
If no link is found, then return null.
Implementation
String? getFirstLink({required String text}) {
List<LinkifyElement> elements = linkify(
text,
options: const LinkifyOptions(
humanize: false,
),
);
for (final e in elements) {
if (e is LinkableElement) {
return e.url;
}
}
return null;
}