diff --git a/packages/devtools_app/lib/src/screens/memory/panes/chart/controller/chart_connection.dart b/packages/devtools_app/lib/src/screens/memory/panes/chart/controller/chart_connection.dart index 0f70fb3d39e..b70e448365b 100644 --- a/packages/devtools_app/lib/src/screens/memory/panes/chart/controller/chart_connection.dart +++ b/packages/devtools_app/lib/src/screens/memory/panes/chart/controller/chart_connection.dart @@ -49,6 +49,9 @@ class ChartConnection extends DisposableController void _stopConnection() { _polling?.cancel(); _polling = null; + // We use state to declare disconnection. + // We cannot use nullness of _polling to check disconnection, because there is async gap in + // `maybeInitialize` when state is already initialized, but _polling is still null. state = ChartConnectionState.stopped; }