findFlightTags method

Future<List<String>> findFlightTags(
  1. List<Line>? lines
)

***** ***** ***** ***** ***** ALL_FINDING_ALGORITHMS ***** ***** ***** ***** *****


find Flight Tags

Implementation

///find Flight Tags
Future<List<String>> findFlightTags(List<Line>? lines) async {
  try {
    List<String> tags = <String>[];
    lines?.forEach((l) {
      String s = l.text!
          .trim()
          .toUpperCase()
          .replaceAll(" ", "")
          .replaceAll("O", "0")
          .replaceAll("L", "1")
          .replaceAll("I", "1")
          .replaceAll("T", "1")
          .replaceAll('Z', '2')
          .replaceAll("G", "9")
          .replaceAll(RegExp(r'[^0-9]'), '');
      if (s.length > 5 &&
          !(l.text?.contains("/") ?? false) &&
          !(l.text?.contains(".") ?? false)) {
        tags.add(s);
      }
    });
    //we return processed output here as a List<String>
    return tags;
  } catch (e) {
    return [];
  }
}