hasMentions function
Check if the text has mentions (@)
Implementation
bool hasMentions(String value) {
const decoratedTextColor = Colors.purple;
final detector = Detector(
textStyle: const TextStyle(),
decoratedStyle: const TextStyle(color: decoratedTextColor),
decorateAtSign: true);
final result = detector.getDetections(value);
final detections = result.where((d) {
if (d.style!.color != decoratedTextColor) return false;
final txt = d.range.textInside(value).trim();
return txt.startsWith('@');
}).toList();
return detections.isNotEmpty;
}