extractUrls method

List<String> extractUrls()

Extracts all http/https URLs from this string.

'Visit https://flutter.dev or http://dart.dev'.extractUrls()
// ['https://flutter.dev', 'http://dart.dev']

Implementation

List<String> extractUrls() {
  final re = RegExp(r'https?://[^\s]+', caseSensitive: false);
  return re.allMatches(this).map((m) => m[0]!).toList();
}