isOnlyLink static method

bool isOnlyLink(
  1. String message
)

Implementation

static bool isOnlyLink(String message) {
  final linkRegExp = RegExp(
    r'((https?:\/\/)?([\w-]+\.)+[\w-]+(\/[\w\- ./?%&=()*]*)?)',
    caseSensitive: false,
  );

  // Check if the message is just a link
  final matches = linkRegExp.allMatches(message.trim());
  return matches.length == 1 && matches.first.group(0) == message.trim();
}