Ensure that the widget is mounted before resetting the state

This commit is contained in:
Vishnu Mohandas 2020-08-14 03:30:19 +05:30
parent 873f1b631d
commit 38b2c76892

View file

@ -76,7 +76,9 @@ class _VideoWidgetState extends State<VideoWidget> {
VideoPlayerController _setVideoPlayerController(String url) {
return _videoPlayerController = VideoPlayerController.network(url)
..initialize().whenComplete(() {
setState(() {});
if (mounted) {
setState(() {});
}
});
}