operatorValues function Null safety

ParserList operatorValues(
  1. List fullList
)

Implementation

ParserList operatorValues(List fullList) {
  if (fullList.isEmpty) {
    return ParserList([]);
  }
  fullList.removeWhere((element) => element is WhiteSpaceParser);
  final parseList = fullList.whereType<OperatorParser>().toList();
  if (parseList.isEmpty) {
    return ParserList(fullList.map((e) => e as FhirPathParser).toList());
  } else {
    parseList.sort((a, b) => (operatorOrderMap[b.runtimeType] ?? 99)
        .compareTo((operatorOrderMap[a.runtimeType] ?? 99)));
    final splitIndex = fullList.indexOf(parseList.first);
    parseList.first.before = operatorValues(fullList.sublist(0, splitIndex));
    parseList.first.after =
        operatorValues(fullList.sublist(splitIndex + 1, fullList.length));
    return ParserList([parseList.first]);
  }
}