@@ -30,6 +30,8 @@ class EditorClient extends DisposableController
3030
3131 String get gaId => EditorSidebar .id;
3232
33+ bool get isDtdClosed => _dtd.isClosed;
34+
3335 Future <void > _initialize () async {
3436 autoDisposeStreamSubscription (
3537 _dtd.onEvent ('Service' ).listen ((data) {
@@ -317,27 +319,6 @@ class EditorClient extends DisposableController
317319 }
318320 }
319321
320- Future <bool > isClientClosed () async {
321- try {
322- // Make an empty request to DTD.
323- await _dtd.call ('' , '' );
324- } on StateError catch (e) {
325- // TODO(https://github.com/flutter/devtools/issues/9028): Replace with a
326- // check for whether DTD is closed. Requires a change to package:dtd.
327- //
328- // This is only a temporary fix. If the error in package:json_rpc_2 is
329- // changed, this will no longer catch it. See:
330- // https://github.com/dart-lang/tools/blob/b55643dadafd3ac6b2bd20823802f75929ebf98e/pkgs/json_rpc_2/lib/src/client.dart#L151
331- if (e.message.contains ('The client is closed.' )) {
332- return true ;
333- }
334- } catch (e) {
335- // Ignore other exceptions. If the client is open, we expect this to fail
336- // with the error: 'Unknown method "."'.
337- }
338- return false ;
339- }
340-
341322 Future <DTDResponse > _call (
342323 EditorMethod method, {
343324 Map <String , Object ?>? params,
0 commit comments