I\'ve created a stateful widget and its parent widget needs to call a function that lives in the child\'s state.
Specifically, I have a class PlayerContainer that create
While Darren Cole's answer above does not work correctly, there is an easy way to circumvent the immediate problem. Instead of
State createState() => vpcs;
final VideoPlayerControllerState vpcs = VideoPlayerControllerState();
write:
State createState(){
vpcs = VideoPlayerControllerState();
return vpcs;
}
VideoPlayerControllerState vpcs;
This way, the state gets re-written everytime createState() is called, which avoids the Failed assertion: line 3819 pos 12: '_state._widget == null': is not true errors.
Still, I guess this is a somewhat hackish solution - can somebody point out a better one?