cleanRedundantIncludes function

void cleanRedundantIncludes(
  1. File file
)

Implementation

void cleanRedundantIncludes(File file) {
  if (!file.existsSync()) return;
  var content = file.readAsStringSync();
  final regex = RegExp(
    '#include\\s+["\'].*?\\.bridge\\.g\\.(cpp|c|mm)["\']',
    multiLine: true,
  );
  if (regex.hasMatch(content)) {
    content = content.replaceAll(regex, '');
    file.writeAsStringSync(content);
  }
}