From 5d8a94c83353bbe7612e92818b62b06d25b12c1f Mon Sep 17 00:00:00 2001 From: riccardocucia Date: Mon, 9 Mar 2026 16:31:34 +0100 Subject: [PATCH 1/2] Make `_focusListener` and `_blurListener` nullable in `WebWidgetsBinding`. --- CHANGELOG.md | 7 +++++++ example/pubspec.yaml | 2 +- lib/src/widgets/user_status_detector/web_platform.dart | 4 ++-- pubspec.yaml | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef7a8b4..71df2ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.6.1] - 2026-03-09 +#### [@rickypid](https://github.com/rickypid) + +### Fixed + +* Make `_focusListener` and `_blurListener` nullable in `WebWidgetsBinding`. + ## [1.6.0] - 2025-06-17 #### [@rickypid](https://github.com/rickypid) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f13f00d..8486ff1 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -2,7 +2,7 @@ name: example description: A new Flutter project. publish_to: 'none' -version: 1.5.1 +version: 1.6.1 environment: sdk: '>=3.4.0 <4.0.0' diff --git a/lib/src/widgets/user_status_detector/web_platform.dart b/lib/src/widgets/user_status_detector/web_platform.dart index 4450203..4cad286 100644 --- a/lib/src/widgets/user_status_detector/web_platform.dart +++ b/lib/src/widgets/user_status_detector/web_platform.dart @@ -7,8 +7,8 @@ import 'platforms_widgets_binding.dart'; PlatformsWidgetsBinding getInstance() => WebWidgetsBinding(); class WebWidgetsBinding extends PlatformsWidgetsBinding { - late JSFunction _focusListener; - late JSFunction _blurListener; + JSFunction? _focusListener; + JSFunction? _blurListener; @override void addObserver(WidgetsBindingObserver state) { diff --git a/pubspec.yaml b/pubspec.yaml index 7e85840..002b874 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_supabase_chat_core description: > Actively maintained, community-driven Supabase BaaS for chat applications with an optional chat UI. -version: 1.6.0 +version: 1.6.1 homepage: https://flutter-supabase-chat-core.insideapp.it repository: https://github.com/insideapp-srl/flutter_supabase_chat_core From 55a0ee3cc35455bde466e5b048ff68457b8a9b45 Mon Sep 17 00:00:00 2001 From: riccardocucia Date: Mon, 9 Mar 2026 16:36:01 +0100 Subject: [PATCH 2/2] Make `_focusListener` and `_blurListener` nullable in `WebWidgetsBinding`. --- lib/src/widgets/user_status_detector/web_platform.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/user_status_detector/web_platform.dart b/lib/src/widgets/user_status_detector/web_platform.dart index 4cad286..caff831 100644 --- a/lib/src/widgets/user_status_detector/web_platform.dart +++ b/lib/src/widgets/user_status_detector/web_platform.dart @@ -26,7 +26,11 @@ class WebWidgetsBinding extends PlatformsWidgetsBinding { @override void removeObserver(WidgetsBindingObserver state) { - web.window.removeEventListener('focus', _focusListener); - web.window.removeEventListener('blur', _blurListener); + if (_focusListener != null) { + web.window.removeEventListener('focus', _focusListener); + } + if (_blurListener != null) { + web.window.removeEventListener('blur', _blurListener); + } } }