buildConditionalReplacer method

String buildConditionalReplacer(
  1. String haystack,
  2. String toReplace,
  3. String replacement
)

Implementation

String buildConditionalReplacer(
  String haystack,
  String toReplace,
  String replacement
){
  final updatedMatch = '''
    #ifdef USE_THREE_HEX_TILING
    $replacement
    #else
    $toReplace
    #endif
  ''';

  return haystack.replaceAll(toReplace, updatedMatch);
}