hasCashtags function

bool hasCashtags(
  1. String value
)

Check if the text has cashtags ($)

Implementation

bool hasCashtags(String value) {
  const decoratedTextColor = Colors.green;
  final detector = Detector(
      textStyle: const TextStyle(),
      decoratedStyle: const TextStyle(color: decoratedTextColor),
      decorateCashtag: 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(r'$');
  }).toList();
  return detections.isNotEmpty;
}