extractFirstPlaceholderKey function

String? extractFirstPlaceholderKey(
  1. String text
)

Extracts placeholder keys from text and replaces them with values from contexts subsequently

Implementation

String? extractFirstPlaceholderKey(String text) {
  // Regular expression to find placeholders like {benefitName}
  final placeholderRegex = RegExp(r'\{([^}]+)\}');
  final match = placeholderRegex.firstMatch(text);
  return match?.group(1);
}