extractUrl static method

String? extractUrl(
  1. String text
)

Implementation

static String? extractUrl(String text) {
  final urlRegExp = RegExp(
    r'(https?:\/\/[^\s]+)', // Matches URLs starting with http:// or https:// and capturing until a space is found
    caseSensitive: false,
    multiLine: true,
  );

  final match = urlRegExp.firstMatch(text);
  return match
      ?.group(0); // Returns the URL found or null if no URL is present
}