14
14
15
15
// [START set_up_environment]
16
16
import 'package:cloud_firestore/cloud_firestore.dart' ;
17
+ import 'package:firebase_auth/firebase_auth.dart' ;
17
18
import 'package:firebase_core/firebase_core.dart' ;
18
19
import 'package:firebase_remote_config/firebase_remote_config.dart' ;
19
20
// [END set_up_environment]
@@ -25,9 +26,7 @@ import 'package:flutter/material.dart';
25
26
import 'firebase_options.dart' ;
26
27
27
28
void main () async {
28
- // TODO: special-case -- be sure to document
29
- // [START get_firestore_instance]
30
-
29
+ // [START get_firestore_instance]
31
30
/// In the Firebase documentation, the code should look like the following example
32
31
/// In this snippets app, we're using the FlutterFire CLI to generate FirebaseOptions
33
32
///```dart
@@ -41,17 +40,14 @@ void main() async {
41
40
/// );
42
41
/// final firestore = FirebaseFirestore.instance;
43
42
/// ```
44
-
45
- // [END get_firestore_instance]
43
+ // [END get_firestore_instance]
46
44
47
45
WidgetsFlutterBinding .ensureInitialized ();
48
46
await Firebase .initializeApp (
49
47
options: DefaultFirebaseOptions .currentPlatform,
50
48
);
51
49
52
50
final db = FirebaseFirestore .instance;
53
- // TODO: special-case -- be sure to document
54
-
55
51
// [START access_data_offline_configure_offline_persistence]
56
52
final settings = db.settings.copyWith (persistenceEnabled: true );
57
53
// [END access_data_offline_configure_offline_persistence]
@@ -66,6 +62,12 @@ void main() async {
66
62
FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig .instance;
67
63
// [END get_started_get_singleton_object]
68
64
65
+ if (kIsWeb) {
66
+ // [START auth_persistingAuthState]
67
+ await FirebaseAuth .instance.setPersistence (Persistence .NONE );
68
+ // [END auth_persistingAuthState]
69
+ }
70
+
69
71
if (! kReleaseMode) db.useFirestoreEmulator ('localhost' , 8080 );
70
72
71
73
runApp (
0 commit comments