isDetected function

bool isDetected(
  1. String value,
  2. RegExp detectionRegExp
)

Check if the text has detection

Implementation

bool isDetected(String value, RegExp detectionRegExp) {
  final decoratedTextColor = Colors.blue;
  final detector = Detector(
    textStyle: TextStyle(),
    detectedStyle: TextStyle(
      color: decoratedTextColor,
    ),
    detectionRegExp: detectionRegExp,
  );
  final result = detector.getDetections(value);
  final detections = result
      .where((detection) => detection.style!.color == decoratedTextColor)
      .toList();
  return detections.isNotEmpty;
}