Skip to content

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

Merged
merged 14 commits into from
Jan 10, 2023

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Jan 9, 2023

RELEASE_NOTE_EXCEPTION=[refactoring]

@polina-c polina-c requested review from elliette, CoderDake and a team as code owners January 9, 2023 18:41

/// This setter should be invoked only by debugger.
void setPausedOnBreakpoint(bool value) => _isPaused.value = value;

ValueListenable<Frame?> get currentFrame => _currentFrame;
Copy link
Contributor

Choose a reason for hiding this comment

The 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?
It sounds important

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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


controlHeight = _isPaused ? defaultButtonHeight : 0.0;
addAutoDisposeListener(
serviceManager.isolateManager.mainIsolateState!.isPaused, () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could isMainIsolatePaused just be a notifier too?
I feel like there is a bit of a disconnect by using isMainIsolatePaused as a proxy to state inside the isolateManager, and then needing to know that the two are connected if you ever want to monitor that the state has changed.
also will _isPaused update here, if the paused state changes?

Copy link
Contributor Author

@polina-c polina-c Jan 10, 2023

Choose a reason for hiding this comment

The 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 .value in many places.
Yes, there are pros and cons here. But, whoever would want to listen to the value, will start with reading the method body and will understand how to monitor the state.
Added documentation to decrease possible confusion.

@polina-c polina-c merged commit 57cb9b8 into flutter:master Jan 10, 2023
@polina-c polina-c deleted the pause branch January 10, 2023 19:08
@CoderDake CoderDake mentioned this pull request Jan 24, 2023
7 tasks
@DartDevtoolWorkflowBot DartDevtoolWorkflowBot mentioned this pull request Jan 24, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants