-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[firebase_auth_web] documentation has confusing instructions #1746
Comments
Hi @emailsubjekt if this is not the case please provide your |
Unclear documentation? Possibly. If you could provide me with an example for the web that works or explain what I'm doing wrong and how to solve it and that differed from your documentation I could say that yes because I was able to understand the android/ios documentation enough to make a working project on cellphones. On the web here, not so much. This is my flutter doctor -v flutter doctor -v [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Chrome - develop for the web [√] Android Studio (version 3.5) [√] VS Code (version 1.41.1) [√] Connected device (3 available) • No issues found! flutter run --verbose is so long the scroll bars don't encompass the written command in the terminal after it finishes, but I've put everything that came out inside that scrollbar area that wasn't deleted as the data came out [ +11 ms] SLVR: fact: async 2.4.0 depends on collection ^1.5.0 #0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3) |
How am I the only one that's getting this error. I just opened another project from someone else and got the same error that led me to here, to my own comment/issue, lol. What the hell. |
i have the same errors
|
Yeah, after following documentation, I cannot run project on iOS Same as @chertov |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Can you please elaborate on what you are trying to do? Can you try |
@hterkelsen Yes, i make flutter clean and flutter pub get every time
js i'm using only for flutter web code implementation
|
i will try to create a new empty project with firebase_auth |
As an experiment can you delete |
@hterkelsen I always do flutter clean and rebuild if I see that kind of issue. And I've done what you asked for, with same errors:
|
Are you importing |
yes, i tried to do this.. it is appears when i run flutter build appbundle and i get the same errors |
package:firebase i'm importing many times |
OK. |
I wonder @chertov why are you making it a That's the only odd thing I see about your yaml: Can you post your complete pubspec.yaml? See What's the difference between dependency and dev_dependency?. |
@hterkelsen
And I am importing:
And thats is using firebase core plugin, it has nothing to do with firebase "for dart". |
@ditman Thanks, it's my mistake that i'm using dev_dependency pubspec.yaml name: auth_test_app
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
firebase_auth: ^0.15.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true lib/main.dart import 'package:firebase/firebase.dart' as fb;
void main() {
fb.App app = fb.app();
app.auth().onAuthStateChanged.listen(
(state) {
print('checkAuth state: $state');
}
);
// runApp(MyApp());
} still the same errors
Ok, Thanks! I will try to use firebase_core instead package:firebase/firebase.dart |
Even though you aren't depending on The only supported way to add cross-platform Firebase support to your app is via the plugins which I linked above. We are currently working on adding web support for |
@rdev-software
It's in progress, here: #1670. |
Ok, i have successfully compiled this minimal example: import 'package:firebase_auth/firebase_auth.dart';
void main() {
final FirebaseAuth _auth = FirebaseAuth.instance;
_auth.onAuthStateChanged.listen(
(state) {
print('checkAuth state: $state');
}
);
// runApp(MyApp());
} Thanks, will to check my code! |
@hterkelsen I am not sure what you said. But I am trying to build it on iOS not android. (even though thats important too). But what I am getting is..."we have released auth plugin" but for other than auth you cant use firebase for web project, because you will break everything :D I will have to wait a few weeks i guess then |
@rdev-software |
i'm using only to check user auth |
@chertov you may be able to achieve what you need with Dart Conditional Imports; you can have some code that runs only for web (and you can import package:firebase inside there), and a Noop or a different code path for mobile devices. It is tricky because you need to be very careful of separating your code so you don't mix web-only with mobile-only implementations (hence why we're putting a lot of effort in the plugins). See it in action here (example from https://github.com/dart-lang/http/blob/master/lib/src/client.dart#L12-L16 This is the trick: import 'client_stub.dart'
// only works on web:
if (dart.library.html) 'browser_client.dart'
// only works on mobile:
if (dart.library.io) 'io_client.dart'; (Look at the package linked above for actual contents of those files) |
@ditman Thank you! Similarly, I separated webrtc and mqtt implementation, but didn’t do it right. VScode shows many errors, but flutter build can build it) |
To Reproduce
Steps to reproduce the behavior:
So this is inside the pubspec.yaml of the official flutter auth web example and then on the official github page you say to just put in THIS
What? What about everything else? Why would you have that in the official pubspec and then advise this? Never mind I said, I'll just try adding it. So I did, I even copied the other thing
Still it doesn't work.
So basically, the official example doesn't even have the libraries advised on that page. This is really confusing. Also, the official example has a class with methods for signin, you can't start that example because it doesn't have a main, so you have to make a new flutter project and then import that firebase auth web class. Now I want to call those methods, well NO you can't because the class isn't set up that way so that you can just call methods inside it, it's not a helper class, well then what do I call and how? Why isn't this a complete example like the flutter auth for android/ios that I got to work a couple of days ago?
So I tried making a main class that I get with a new flutter project and then in the under floatingActionButton I tried calling this class you provided with signin methods and I did this not
knowing what credential is and how I should provide it.
What is credential and how do I provide it ?
This is the method in the class you provide for Flutter Auth Web, and inside it has this, meaning I can't really call any of the methods inside because first it will call this:
The text was updated successfully, but these errors were encountered: