Skip to content

Commit

Permalink
fix(firestore): fix emulator reload on Flutter 3.10 (#10965)
Browse files Browse the repository at this point in the history
* fix(firestore): fix emulator reload on Flutter 3.10

* fix(firestore): fix emulator reload on Flutter 3.10

* fix(firestore): fix emulator reload on Flutter 3.10
  • Loading branch information
Lyokone committed May 16, 2023
1 parent 7745910 commit f099eb0
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ class FirebaseFirestore extends FirebasePluginPlatform {
try {
_delegate.useEmulator(host, port);
} catch (e) {
final String code = (e as dynamic).code;
// We convert to string to be compatible with Flutter <= 3.7 and Flutter >= 3.10
// .code is only available in Flutter <= 3.7
String strError = e.toString();

// this catches FirebaseError from web that occurs after hot reloading & hot restarting
if (code != 'failed-precondition') {
if (!strError.contains('failed-precondition')) {
rethrow;
}
}
Expand Down

0 comments on commit f099eb0

Please sign in to comment.