File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
packages/firebase_app_check/firebase_app_check_web/lib/src/interop Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import 'dart:js_interop_unsafe';
8
8
9
9
import 'package:firebase_app_check_platform_interface/firebase_app_check_platform_interface.dart' ;
10
10
import 'package:firebase_core_web/firebase_core_web_interop.dart' ;
11
+ import 'package:flutter/foundation.dart' ;
11
12
12
13
import 'app_check_interop.dart' as app_check_interop;
13
14
@@ -76,8 +77,21 @@ class AppCheck extends JsObjectWrapper<app_check_interop.AppCheckJsImpl> {
76
77
// ignore: close_sinks
77
78
_idTokenChangedController;
78
79
79
- String _appCheckWindowsKey (String appName) =>
80
- 'flutterfire-${appName }_onTokenChanged' ;
80
+ // purely for debug mode and tracking listeners to clean up on "hot restart"
81
+ final Map <String , int > _tokenListeners = {};
82
+ String _appCheckWindowsKey (String appName) {
83
+ if (kDebugMode) {
84
+ final key = 'flutterfire-${appName }_onTokenChanged' ;
85
+ if (_tokenListeners.containsKey (key)) {
86
+ _tokenListeners[key] = _tokenListeners[key]! + 1 ;
87
+ } else {
88
+ _tokenListeners[key] = 0 ;
89
+ }
90
+ return '$key -${_tokenListeners [key ]}' ;
91
+ }
92
+ return 'no-op' ;
93
+ }
94
+
81
95
Stream <app_check_interop.AppCheckTokenResult > onTokenChanged (String appName) {
82
96
final appCheckWindowsKey = _appCheckWindowsKey (appName);
83
97
unsubscribeWindowsListener (appCheckWindowsKey);
You can’t perform that action at this time.
0 commit comments