ruleExists function

bool ruleExists(
  1. String fileContents,
  2. String rule
)

Implementation

bool ruleExists(String fileContents, String rule) {
  bool result = false;
  List<String> fileC = fileContents.split('\n');
  for (int i = 0; i < fileC.length; i++) {
    String line = fileC[i];
    List<String> ruleTup = getMatches(line);
    if (ruleTup.length == 2) {
      if (ruleTup[0] == rule) {
        result = true;
      } else {}
    } else {}
  }
  return result;
}