BUGFIX: always dispose animation controller #7
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.
We started using your package and noticed that
_CameraFileState
doesn't properly dispose of_animationController
. This was causing our app to crash with a "red screen of death" whenever we utilizedMultipleImageCamera.capture
multiple times. (I.e. open camera, take a picture, do something, go back, open another camera, take a picture...) Thanks to the code in this PR the crashes are gone 🎉I have attached a screen recording that shows a typical sequence of unhandled errors that leads to the "red screen of death". The errors include:
FlutterError: _CameraFileState was disposed with an active Ticker.
_AssertionError '_elements.contains(element': is not true
FlutterError duplicate GlobalKeys detected in widget tree.
We'd be honored if you were to use this code to create a new release for https://pub.dev/packages/multiple_image_camera.
Screen.Recording.2024-07-26.at.15.09.47.1.mov