@@ -89,6 +89,9 @@ platform :ios, '8.0'
8989You can find this at the top of the ` Podfile ` .
9090
9191### 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:
9295
9396You'll need to modify the ` web/index.html ` of your app following the Firebase setup instructions:
9497
@@ -237,17 +240,30 @@ RaisedButton(
237240```
238241
239242### 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+
241245``` dart
242- final user = context.getSignedInUser()
246+ final litUser = context.getSignedInUser();
247+ litUser.when(
248+ (user) => print(user.uid),
249+ empty: () {},
250+ initializing: () {},
251+ );
243252```
244253
254+ The ` value.user ` is the Firebase ` User ` object.
255+
245256### 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) .
247258``` 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+ );
249265```
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() ` .
251267
252268### Determine if submitting is active
253269 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).
582598## Starware
583599
584600Lit 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