hasSpeech method Null safety

Future<List<SpeechConditionMatch>> hasSpeech(
  1. EngineNotification notification
)

Checks for files to play for the conditions matching the current notification

Implementation

Future<List<SpeechConditionMatch>> hasSpeech(
    EngineNotification notification) async {
  if (activePack.conditions.isEmpty) return [];

  final validConditions = await filterConditions(notification);
  if (validConditions.isEmpty) return [];

  final speechFileCtrl = SpeechPackFileController.instance;
  return validConditions
      .map((condition) => SpeechConditionMatch(
            condition: condition,
            files: speechFileCtrl.resolveSpeechFiles(activePack, condition),
          ))
      .toList();
}