@@ -89,6 +89,9 @@ platform :ios, '8.0'
89
89
You can find this at the top of the ` Podfile ` .
90
90
91
91
### Web integration
92
+ Follow normal [ Firebase Initialization] ( https://firebase.flutter.dev/docs/installation/web )
93
+
94
+ The above should be sufficient, and should provide up to date information. But for additional information, please see below:
92
95
93
96
You'll need to modify the ` web/index.html ` of your app following the Firebase setup instructions:
94
97
@@ -237,17 +240,30 @@ RaisedButton(
237
240
```
238
241
239
242
### Get current user
240
- Get the current signed-in user:
243
+ Depending on the status of the user you'll get a different state: empty, initializing, or success.
244
+
241
245
``` dart
242
- final user = context.getSignedInUser()
246
+ final litUser = context.getSignedInUser();
247
+ litUser.when(
248
+ (user) => print(user.uid),
249
+ empty: () {},
250
+ initializing: () {},
251
+ );
243
252
```
244
253
254
+ The ` value.user ` is the Firebase ` User ` object.
255
+
245
256
### Watch user for changes
246
- Watches the ` User ` object for changes.
257
+ Watches the Firebase ` User ` object for changes. Will be triggered every time the Firebase ` User ` changes (for example, on logout or new sign in) .
247
258
``` dart
248
- final user = context.watchSignedInUser()
259
+ final litUser = context.watchSignedInUser();
260
+ litUser.when(
261
+ (user) => Text('Signed in ${user.uid}'),
262
+ empty: () => Text('Not signed in'),
263
+ initializing: () => Text('Loading'),
264
+ );
249
265
```
250
- Should only be used in the build method.
266
+ The above should only be used in the build method. If you need direct access to the current user, prefer ` context.getSignedInUser() ` .
251
267
252
268
### Determine if submitting is active
253
269
Whether Lit Firebase is currently attempting to authenticate. Can be used to show a loading indicator.
@@ -582,4 +598,4 @@ This will display a column of icons (images).
582
598
## Starware
583
599
584
600
Lit Firebase is Starware
585
- This means you're free to use the project, as long as you star ⭐ its GitHub repository or give a thumbs up 👍 on Pub.
601
+ This means you're free to use the project, as long as you star ⭐ its GitHub repository or give a thumbs up 👍 on Pub.
0 commit comments