extractUrls static method

List<String> extractUrls(
  1. String text
)

Extract URLs from string

text - The text to extract URLs from Returns list of URLs found

Implementation

static List<String> extractUrls(String text) {
  final regex = RegExp(r'https?://[^\s]+');
  return regex.allMatches(text).map((match) => match.group(0)!).toList();
}