use_build_context_synchronously

"message": "Don't use 'BuildContext's across async gaps.\nTry rewriting the code to not use the 'BuildContext', or guard the use with a 'mounted' check.",
This commit is contained in:
NBA2K1 2024-12-16 15:51:36 +01:00
parent ae1db05f04
commit 1b16573b06

View file

@ -54,8 +54,10 @@ class _MangaWebViewState extends ConsumerState<MangaWebView> {
..setBrightness(Brightness.dark)
..launch(widget.url)
..onClose.whenComplete(() {
timer.cancel();
Navigator.pop(context);
if (mounted) {
timer.cancel();
Navigator.pop(context);
}
});
}