File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
packages/cloud_firestore/cloud_firestore/lib/src Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,15 @@ class FirebaseFirestore extends FirebasePluginPlatform {
108
108
void useFirestoreEmulator (String host, int port, {bool sslEnabled = false }) {
109
109
if (kIsWeb) {
110
110
// use useEmulator() API for web as settings are set immediately unlike native platforms
111
- _delegate.useEmulator (host, port);
111
+ try {
112
+ _delegate.useEmulator (host, port);
113
+ } catch (e) {
114
+ final String code = (e as dynamic ).code;
115
+ // this catches FirebaseError from web that occurs after hot reloading & hot restarting
116
+ if (code != 'failed-precondition' ) {
117
+ rethrow ;
118
+ }
119
+ }
112
120
} else {
113
121
String mappedHost = host;
114
122
// Android considers localhost as 10.0.2.2 - automatically handle this for users.
You can’t perform that action at this time.
0 commit comments