Well, now sockets actually detach from events, when changing screens

This commit is contained in:
Andrew 2023-03-05 17:43:21 +07:00
parent e7e052e3a1
commit 8a586f0fe6
2 changed files with 23 additions and 4 deletions

View file

@ -92,6 +92,17 @@ class _GamePageState extends State<GamePage> {
});
}
@override
void dispose() {
socket.off("hello");
socket.off("gameStatus");
socket.off("leaveGameResponse");
socket.off("chatResponse");
socket.off("guessResponse");
socket.off("guess");
super.dispose();
}
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;