-
Notifications
You must be signed in to change notification settings - Fork 344
Use isolateManager as source of truth for isPaused. #5018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dc7c62f
816298c
86916b8
a0adf5e
900ef1d
db55908
c7b9e58
37655aa
eb9ae5b
2882c0b
ef938f1
eedc213
aa943d1
bd174b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,27 +360,29 @@ class DebuggerStatus extends StatefulWidget { | |
class _DebuggerStatusState extends State<DebuggerStatus> with AutoDisposeMixin { | ||
String _status = ''; | ||
|
||
bool get _isPaused => serviceManager.isMainIsolatePaused; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
addAutoDisposeListener( | ||
serviceManager.appState.isPaused, | ||
() => unawaited( | ||
_updateStatus(), | ||
), | ||
); | ||
|
||
_updateStatusOnPause(); | ||
unawaited(_updateStatus()); | ||
} | ||
|
||
@override | ||
void didUpdateWidget(DebuggerStatus oldWidget) { | ||
super.didUpdateWidget(oldWidget); | ||
|
||
// todo: should we check that widget.controller != oldWidget.controller? | ||
if (widget.controller == oldWidget.controller) return; | ||
|
||
polina-c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cancelListeners(); | ||
_updateStatusOnPause(); | ||
} | ||
|
||
void _updateStatusOnPause() { | ||
addAutoDisposeListener( | ||
serviceManager.appState.isPaused, | ||
serviceManager.isolateManager.mainIsolateState!.isPaused, | ||
() => unawaited( | ||
_updateStatus(), | ||
), | ||
|
@@ -406,9 +408,7 @@ class _DebuggerStatusState extends State<DebuggerStatus> with AutoDisposeMixin { | |
} | ||
|
||
Future<String> _computeStatus() async { | ||
final paused = serviceManager.appState.isPaused.value; | ||
|
||
if (!paused) { | ||
if (!_isPaused) { | ||
return 'running'; | ||
} | ||
|
||
|
@@ -447,20 +447,21 @@ class _FloatingDebuggerControlsState extends State<FloatingDebuggerControls> | |
with | ||
AutoDisposeMixin, | ||
ProvidedControllerMixin<DebuggerController, FloatingDebuggerControls> { | ||
late bool paused; | ||
|
||
late double controlHeight; | ||
|
||
bool get _isPaused => serviceManager.isMainIsolatePaused; | ||
|
||
@override | ||
void didChangeDependencies() { | ||
super.didChangeDependencies(); | ||
if (!initController()) return; | ||
paused = serviceManager.appState.isPaused.value; | ||
controlHeight = paused ? defaultButtonHeight : 0.0; | ||
addAutoDisposeListener(serviceManager.appState.isPaused, () { | ||
cancelListeners(); | ||
|
||
controlHeight = _isPaused ? defaultButtonHeight : 0.0; | ||
addAutoDisposeListener( | ||
polina-c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
serviceManager.isolateManager.mainIsolateState!.isPaused, () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could isMainIsolatePaused just be a notifier too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isMainIsolatePaused is a helper method. It's value is in shortening the code. If I make it notifier, the code will increase by |
||
setState(() { | ||
paused = serviceManager.appState.isPaused.value; | ||
if (paused) { | ||
if (_isPaused) { | ||
controlHeight = defaultButtonHeight; | ||
} | ||
}); | ||
|
@@ -470,10 +471,10 @@ class _FloatingDebuggerControlsState extends State<FloatingDebuggerControls> | |
@override | ||
Widget build(BuildContext context) { | ||
return AnimatedOpacity( | ||
opacity: paused ? 1.0 : 0.0, | ||
opacity: _isPaused ? 1.0 : 0.0, | ||
duration: longDuration, | ||
onEnd: () { | ||
if (!paused) { | ||
if (!_isPaused) { | ||
setState(() { | ||
controlHeight = 0.0; | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,12 +250,6 @@ class AppState extends DisposableController with AutoDisposeControllerMixin { | |
final _variables = ValueNotifier<List<DartObjectNode>>([]); | ||
void setVariables(List<DartObjectNode> value) => _variables.value = value; | ||
|
||
ValueListenable<bool> get isPaused => _isPaused; | ||
final _isPaused = ValueNotifier<bool>(false); | ||
|
||
/// This setter should be invoked only by debugger. | ||
void setPausedOnBreakpoint(bool value) => _isPaused.value = value; | ||
|
||
ValueListenable<Frame?> get currentFrame => _currentFrame; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it ok for us to be removing the setPausedOnBreakpoint function in a refactor? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the value here _isPaused not used any more, so setter does not make sense |
||
final _currentFrame = ValueNotifier<Frame?>(null); | ||
void setCurrentFrame(Frame? value) => _currentFrame.value = value; | ||
|
@@ -267,7 +261,6 @@ class AppState extends DisposableController with AutoDisposeControllerMixin { | |
@override | ||
void dispose() { | ||
_variables.dispose(); | ||
_isPaused.dispose(); | ||
_currentFrame.dispose(); | ||
super.dispose(); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.