apply method

  1. @override
Future<String> apply(
  1. String content,
  2. Map<String, dynamic> context
)
override

Implementation

@override
Future<String> apply(String content, Map<String, dynamic> context) async {
  return content.replaceAllMapped(_selectedRegex, (match) {
    final condition = match.group(1)!.trim();

    try {
      final result = _evaluate(condition, context);
      return result ? 'selected' : '';
    } catch (_) {
      return '';
    }
  });
}