[flutter_tool] Make Device.dispose() abstract #46006
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We were failing to unforward ports for Android. The resident runner is calling
Device.dispose()
in the correct places, butAndroidDevice
was inheriting a no-opdispose()
method from theDevice
base class. This PR removes the no-opdispose
from theDevice
base class (and a couple others). This requires implementers ofDevice
to provide an implementation that makes sense. On Android,dispose()
now unforwards ports.Related Issues
Fixes #45948
Tests
I added the following tests:
Added a test to resident_runner_test.dart that ensures that the resident runner is calling dispose() on devices. Added tests to platform specific device tests that calling dispose() on the device results in a call to dispose() on the devices' port forwarders, where appropriate.
Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?