From 9822d15f86257100534cf26dfc7f77e07dfceeba Mon Sep 17 00:00:00 2001 From: OutdatedGuy <74326345+OutdatedGuy@users.noreply.github.com> Date: Thu, 21 Jul 2022 08:33:41 +0530 Subject: [PATCH] REFACTOR: optimized code with null check --- lib/templates.dart | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/templates.dart b/lib/templates.dart index d604876..a04edf2 100644 --- a/lib/templates.dart +++ b/lib/templates.dart @@ -519,14 +519,8 @@ const List _indexHtmlBrandingPicture = [ const String _webJS = ''' function removeSplashFromWeb() { - const elem = document.getElementById("splash"); - if (elem) { - elem.remove(); - } - const elem2 = document.getElementById("splash-branding"); - if (elem2) { - elem2.remove(); - } + document.getElementById("splash")?.remove(); + document.getElementById("splash-branding")?.remove(); document.body.style.background = "transparent"; } ''';