packages
packages copied to clipboard
[video_player] Remove added listener before unmounting widget in example
Fixes #122690 by removing added listener before unmounting the widget in the example code. I slightly changed the solution I proposed in the issue. I moved the code to remove the listener from dispose method to the listener itself because the first fix wasn't working in this example. The listener was being called one more time after calling Navigator.pop(context) but before the videoPlayerController.removeListener(listener); is called in dispose method.
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use
dart format.) - [] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I listed at least one issue that this PR fixes in the description above.
- [ ] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [ ] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style. - [ ] I updated/added relevant documentation (doc comments with
///). - [ ] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).
If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?
Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
It would also be good to add a test of this issue; we don't currently have tests for the example, but this issue illustrates that it would benefit from tests.
Thanks for the contribution! This will need a version update per our contributing docs (the currently unchecked items in the PR template checklist).
Please give this a clearer name (e.g., _onVideoControllerValueUpdated).
Hey @stuartmorgan, I just pushed a commit that applies the feedback. Thanks
It would also be good to add a test of this issue; we don't currently have tests for the example, but this issue illustrates that it would benefit from tests.
That's true, but I don't know how I can test that. And I'm afraid I don't have enough time to look into it now. If anyone else can add a commit for it, that would be great.
That's true, but I don't know how I can test that.
If the issue is that a certain set of steps in the UI crashes, then it would be tested with an integration test (or a widget test if it reproduces there) that does those steps.
Marking as a draft pending the integration test discussed above.
Anyone interested is welcome to contribute a test.
Since this is marked as a draft and hasn't been updated in several months I'm going to close it to clean out our review queue. Please don't hesitate to submit a new PR if you decide to revisit this. Thanks!