extractDetections static method
Extract detections from the text
Implementation
static List<String> extractDetections(
String value,
RegExp detectionRegExp,
) {
final decoratedTextColor = Colors.blue;
final decorations = value.toDetections(
textStyle: TextStyle(),
detectedStyle: TextStyle(color: decoratedTextColor),
detectionRegExp: detectionRegExp,
);
final taggedDecorations = decorations
.where((decoration) => decoration.style!.color == decoratedTextColor)
.toList();
final result = taggedDecorations.map((decoration) {
final text = decoration.range.textInside(value);
return text.trim();
}).toList();
return result;
}