refactored code in storage.dart (#2766)

Follow up to https://github.com/dart-lang/webdev/pull/2765

fixes https://github.com/dart-lang/sdk/issues/62509
diff --git a/dwds/debug_extension/web/storage.dart b/dwds/debug_extension/web/storage.dart
index 2babba4..f8f5922 100644
--- a/dwds/debug_extension/web/storage.dart
+++ b/dwds/debug_extension/web/storage.dart
@@ -105,10 +105,8 @@
 T _deserialize<T>(String json) {
   if (T == String) return json as T;
   final decoded = jsonDecode(json);
-  if (T == DebugInfo) {
-    return DebugInfo.fromJson(decoded as List<dynamic>) as T;
-  }
   return switch (decoded) {
+    ['DebugInfo', ...] => DebugInfo.fromJson(decoded) as T,
     ['ConnectFailure', ...] => ConnectFailure.fromJson(decoded) as T,
     ['DebugStateChange', ...] => DebugStateChange.fromJson(decoded) as T,
     ['DevToolsOpener', ...] => DevToolsOpener.fromJson(decoded) as T,