-
-
Notifications
You must be signed in to change notification settings - Fork 975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(firebase_login): add firebase login example app #3946
base: master
Are you sure you want to change the base?
docs(firebase_login): add firebase login example app #3946
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@@ -0,0 +1 @@ | |||
{"flutter":{"platforms":{"android":{"default":{"projectId":"fb-login-riverpod","appId":"1:359355392679:android:942c58c04ec3c1f105f182","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"fb-login-riverpod","appId":"1:359355392679:ios:3e31b15579c4b6e005f182","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"fb-login-riverpod","configurations":{"android":"1:359355392679:android:942c58c04ec3c1f105f182","ios":"1:359355392679:ios:3e31b15579c4b6e005f182"}}}}}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit this
// gestures. You can also use WidgetTester to find child widgets in the widget | ||
// tree, read text, and verify that the values of widget properties are correct. | ||
|
||
import 'package:flutter/material.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either write proper tests or delete this
I don't like the proposed folder architecture. Please don't use kind-based folders such as Instead use feature-based folders like |
@@ -0,0 +1,70 @@ | |||
// File generated by FlutterFire CLI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit this
@@ -0,0 +1,40 @@ | |||
import 'dart:developer'; | |||
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't useful in the context of a Firebase example
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo), | ||
useMaterial3: false, | ||
), | ||
home: authState.when( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use .when
Instead use switch (authState)
Thanks for this! I gave a very quick look at the current state, and suggested broad changes. I'll look move closely at the details once we agree on the basics :) Note: It'd be useful to update the README with:
|
Thanks for the quick review and feedback, Remi. I'll make the changes as suggested, and I'll make sure to verify the architecture with you before I start moving things around, so we’re on the same page. I'll add instructions to the README as well. |
Cool :) If you have any doubt, feel free to ask questions! |
@rrousselGit I have considered your suggestions and come up with this structure, what do you think about it? lib/
├── auth/
│ ├── auth_repository.dart
│ ├── user.dart
├── app/
│ ├── app_state.dart // e.g., app state provider (auth state can be renamed)
│ ├── app.dart // MaterialApp widget, route initialization
├── sign_in/
│ ├── sign_in_page.dart
│ ├── sign_in_state.dart // Providers related to sign-in
├── sign_up/
│ ├── sign_up_page.dart
│ ├── sign_up_state.dart // Providers related to sign-up
├── home/
│ ├── home_page.dart
├── main.dart
├── provider_observer.dart Also, I noticed your comment regarding If you feel it doesn't add enough value here, I'm happy to remove it! I just thought it might be beneficial to keep it for the debugging phase and as a teaching point for others reviewing the example. |
Must better!
I think it's better to remove it. IMO, less is more. The more noise we add, the harder it is for people to find what they are looking for. Demonstrating how to do those things is valuable. But it should likely be a separate example instead. This one is about Firebase auth. We can have another example for demonstrating logging (including Crashlytics interaction). If this example contains something, it should be closely related to Firebase Auth. |
Actually about the folder structure, I'd still change a few things. What I'd personally do is:
For UI, I usually go with "one file per route". It's good to keep the provider and its view in the same file. No need to separate them |
Description
Adds a Flutter app example that demonstrates how to handle authentication with Firebase using Riverpod.
SnackBar
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).I have updated the
CHANGELOG.md
of the relevant packages.Changelog files must be edited under the form:
If this contains new features or behavior changes,
I have updated the documentation to match those changes.