From 300fc31e62d58a9a9157e39c1d0b5497123e4ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Ma=C3=B1osa?= Date: Mon, 4 Nov 2024 00:43:55 +0100 Subject: [PATCH] =?UTF-8?q?refactor(model):=20=E2=99=BB=EF=B8=8F=20use=20b?= =?UTF-8?q?riefer=20`switch`=20cases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Albert MaƱosa --- lib/src/model/definition_entry_senses.dart | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/src/model/definition_entry_senses.dart b/lib/src/model/definition_entry_senses.dart index 729129d..b882cb1 100644 --- a/lib/src/model/definition_entry_senses.dart +++ b/lib/src/model/definition_entry_senses.dart @@ -22,16 +22,12 @@ extension DefinitionEntrySenses on List { final tempDefinitionElements = []; for (final child in body.children) { - if (child.localName == 'br') { - if (tempDefinitionElements.isNotEmpty) { + switch (child) { + case Element(localName: 'br') when tempDefinitionElements.isNotEmpty: definitions.add(tempDefinitionElements.toList()); tempDefinitionElements.clear(); - } - continue; - } - - if (child.localName == 'span') { - tempDefinitionElements.add(child); + case Element(localName: 'span'): + tempDefinitionElements.add(child); } }