findNotUsedArbTerms method

Set<String> findNotUsedArbTerms(
  1. Set<String> arbTerms,
  2. List<String> pathFiles
)

Implementation

Set<String> findNotUsedArbTerms(
  Set<String> arbTerms,
  List<String> pathFiles,
) {
  final unused = arbTerms.toSet();
  final length = pathFiles.length;
  for (final path in pathFiles) {
    stdout.write(
        '\r${((pathFiles.indexOf(path) + 1) / length * 100).toStringAsFixed(0)}%');
    final content = File(path).readAsStringSync();
    for (final arb in arbTerms) {
      if (content.contains(RegExp(
          'S(\\s+)?.(\\s+)?of(context)(\\s+)?.(\\s+)?$arb|context(\\s+)?.(\\s+)?s(\\s+)?.(\\s+)?$arb'))) {
        unused.remove(arb);
      }
    }
  }
  return unused;
}