match method Null safety

Future<bool> match(
  1. EngineNotification notification,
  2. SpeechCondition condition
)

Matches a notification against a condition

Implementation

Future<bool> match(
    EngineNotification notification, SpeechCondition condition) async {
  // No match if audio is muted
  if (EngineSettingsController.instance.item.muteAudio) return false;

  for (final matcher in registry) {
    try {
      if (await matcher.match(notification, condition)) {
        return true;
      }
    } on Exception {
      return false;
    }
  }

  // No match found
  return false;
}