When using the media_kit video player package in a Flutter video player app, I encounter an error when I fullscreen the video player and then return to the portrait screen. The error message suggests that there is an issue with the widget tree and the dependencies between the widgets. Specifically, it seems that a widget is trying to access an ancestor that is no longer in the widget tree.
I have tried disposing of the video player properly when it is closed, but the issue persists. I have also checked that I am not adding any unnecessary dependencies to the video player, but the issue still occurs.
Here is the error message I receive:
'package:flutter/src/widgets/framework.dart': Failed assertion: line 6055 pos 14: '() {
// check that it really is our descendant
Element? ancestor = dependent._parent;
while (ancestor != this && ancestor != null) {
ancestor = ancestor._parent;
}
return ancestor == this;
}()': is not true.
logs:
═══════ Exception caught by widgets library ═══════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 6055 pos 14: '() {
// check that it really is our descendant
Element? ancestor = dependent._parent;
while (ancestor != this && ancestor != null) {
ancestor = ancestor._parent;
}
return ancestor == this;
}()': is not true.
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 5917 pos 14: '_dependents.isEmpty': is not true.
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════
I/media_kit(21275): com.alexmercerind.media_kit_video.VideoOutputManager.create: -5476376645871447984
════════ Exception caught by scheduler library ═════════════════════════════════
Tried to build dirty widget in the wrong build scope.
════════════════════════════════════════════════════════════════════════════════
I/media_kit(21275): flutterJNIAPIAvailable = true
I/media_kit(21275): com.alexmercerind.media_kit_video.VideoOutput: id = 1
I/flutter (21275): {id: 1}
I/flutter (21275): media_kit: wakelock: _count = 2
════════ Exception caught by widgets library ═══════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 6055 pos 14: '() {
// check that it really is our descendant
Element? ancestor = dependent._parent;
while (ancestor != this && ancestor != null) {
ancestor = ancestor._parent;
}
return ancestor == this;
}()': is not true.
The relevant error-causing widget was:
I have created a minimal reproducible example that demonstrates the issue and have attached it to this issue.

@zezo357
I would appreciate it if you could investigate this issue and provide a fix. Thank you.
When using the media_kit video player package in a Flutter video player app, I encounter an error when I fullscreen the video player and then return to the portrait screen. The error message suggests that there is an issue with the widget tree and the dependencies between the widgets. Specifically, it seems that a widget is trying to access an ancestor that is no longer in the widget tree.
I have tried disposing of the video player properly when it is closed, but the issue persists. I have also checked that I am not adding any unnecessary dependencies to the video player, but the issue still occurs.
Here is the error message I receive:
logs:
I have created a minimal reproducible example that demonstrates the issue and have attached it to this issue.

@zezo357
I would appreciate it if you could investigate this issue and provide a fix. Thank you.