From b8a300c76118faae3037ae6980735d3dc3fcb76b Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 15 Mar 2024 13:01:34 -0400 Subject: [PATCH] Allow for null responses from `ServerConnectionStorage.getValue` The `Storage` interface already specifies that the return type should be nullable, but `ServerConnectionStorage` further restricted it to be non-nullable. If a key was looked up and it did not have an entry in storage, this would cause a type error and cause DevTools to hang on start in some situations. Fixes https://github.com/flutter/devtools/issues/7373 --- .../framework_initialize/_framework_initialize_web.dart | 2 +- .../devtools_app/lib/src/shared/server/server_api_client.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/devtools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart b/packages/devtools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart index d3b35c5e1cd..89df4e90936 100644 --- a/packages/devtools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart +++ b/packages/devtools_app/lib/src/shared/config_specific/framework_initialize/_framework_initialize_web.dart @@ -94,7 +94,7 @@ class ServerConnectionStorage implements Storage { final DevToolsServerConnection connection; @override - Future getValue(String key) { + Future getValue(String key) { return connection.getPreferenceValue(key); } diff --git a/packages/devtools_app/lib/src/shared/server/server_api_client.dart b/packages/devtools_app/lib/src/shared/server/server_api_client.dart index 3a345856e3c..523f9e901bc 100644 --- a/packages/devtools_app/lib/src/shared/server/server_api_client.dart +++ b/packages/devtools_app/lib/src/shared/server/server_api_client.dart @@ -203,7 +203,7 @@ class DevToolsServerConnection { /// Retrieves a preference value from the DevTools configuration file at /// ~/.flutter-devtools/.devtools. - Future getPreferenceValue(String key) { + Future getPreferenceValue(String key) { return _callMethod('getPreferenceValue', { 'key': key, });