Skip to content

Commit

Permalink
fix: update firebase_auth example to not be dependent on an emulator (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
seanwestfall committed Jun 1, 2022
1 parent 3dfc099 commit bdc9772
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/firebase_auth/firebase_auth/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import 'package:firebase_core/firebase_core.dart';
import 'auth.dart';
import 'profile.dart';

/// Requires that a Firebase local emulator is running locally.
/// See https://firebase.flutter.dev/docs/auth/start/#optional-prototype-and-test-with-firebase-local-emulator-suite
bool shouldUseFirebaseEmulator = false;

// Requires that the Firebase Auth emulator is running locally
// e.g via `melos run firebase:emulator`.
Future<void> main() async {
Expand All @@ -31,7 +35,9 @@ Future<void> main() async {
);
}

await FirebaseAuth.instance.useAuthEmulator('localhost', 9099);
if (shouldUseFirebaseEmulator) {
await FirebaseAuth.instance.useAuthEmulator('localhost', 9099);
}

runApp(const AuthExampleApp());
}
Expand Down

0 comments on commit bdc9772

Please sign in to comment.