I usually don't comment but jesus man you are amazing. No BS, filler crap or anything, straight to the point. Also cannot thank you enough for not using a complicated UI so we see what's actually going on.
Thank you so much! That is what I aim to do in every video. And for me it also makes it a lot simpler using easy UIs because the logic doesn’t get lost in ther e
fyi just to update everyone: FirebaseUser is now User. And you must instantiate not just Rx firebaseUser... While using a GetxController on a class, and using Rx to get a FirebaseUser , you'll be shown an error, that you are missing a positional argument! Use this instead: Rxn firebaseUser = Rxn();
@@tadaspetra I am currently working on an example but can't get the authentication controller to run before GetMaterialApp without running into an error where the controller is not found. I followed a tutorial from another RUclipsr but he does the authentication through a Splash screen (which I don't like). I can send you the link to the RUclipsr videos I just mentioned but it's in spanish. Let me know. I am still working on my own example and will let you know if I get it fixed.
I really liked getx, but still have one question about the right architecture for that package. Because it can fit to mvc and mvvm, but there are a few pretty uncomfortable moments when you try to build this type of architecture in your app. Is it a nice practice to connect one controller to e.g 2 viems?
Everythings was work fine but yesterday I migrate the Flutter version to the latest one Flutter 2.2 (stable)and dart SDK version to 2.13(stable). After migration, I get an error on the auth_controller file. Rx _user = Rx(); in that line, it says 1 positional argument(s) expected, but 0 found. Any one help me please!😐
Hii Bro, i run this code but shows error => *1.Too few positional arguments: 1 required, 0 given. Rx _firebaseUser = Rx(); @AuthController. *2. The getter 'documentID' isn't defined for the type 'DocumentSnapshot'. Try importing the library that defines 'documentID', correcting the name to the name of an existing getter, or defining.. @UserModel Please give me a solution Bro..
Great , did you think before if you want pass an a argument in controller constructor and defined it 'controller' before widget builder not wrap a widget builder with GetX or GetBuilder!
GetWidget allows you to access controller by simply writing the keyword controller else you have to initialize the controller by sth like Get.put or Get.find manually.
In the documentation it says "The use case [of GetWidget] is very rare, but very specific" but in this app we are using it for every screen. I feel like this is not intended. Correct me if I'm wrong.
For those having problem with e.message , Problem solved by adding "on FirebaseAuthException" before "catch" and converting "e.message" to "e.message.tostring()" Full Code: void createUser(String email, String password) async { try { await _auth .createUserWithEmailAndPassword(email: email, password: password) .then((value) => Get.offAll(Home())); } on FirebaseAuthException catch (e) { Get.snackbar("Error while creating account", e.message.toString(), snackPosition: SnackPosition.BOTTOM); } }
Why does the app not log out when you are doing logout() from another screen, I understand the Obx as observing the stream, and reacting to it. Is it not supposed to return Login() when I am down the widget tree, in say "profile" screen. I am coming from a provider mindset where a stream in main.dart use to do this.
I still didn't understand how the Get.back() works in signup. As of my understanding if the user authstate changes then the obx code will run and it will re-run the root code. Isn't it enough to update the user to the home screen, even he is logged from the signup screen? Please reply.
For having an initialBinding in my GetMaterialApp, is it possible to place multiple unique controllers inside one binding? Since my project needs like ~15 controllers, which (almost all) need to be loaded at the start of the application and display fetched data in a dashboard-kind-of-home-page.
Yes, should definitely be possible. There is nothing stopping you from initializing 10000 controllers in a binding.....except maybe the processor power 😂
@@tadaspetra When chat app coming brother? Please use GetX, and more importantly Realtime Database for chat functionality because in real world scenario RTDB is about 5 times cheaper than Firestore for chatting.
Dear sir, when I try to do this I got an error " The getter 'email' was called on null. Receiver: null Tried calling: email " and I still cannot fix it. Any help me please. thanks in advance!
It should be very similar. Firebase Auth provides the data for what use is authenticated, it doesn't matter whether it's from GoogleSignIn or normal. And in the book club series we added google sign in, so you can take a look there too
@@viniciusgregorio1412 yeah it had something to do with get version use this version ^3.26.0 it will fix it or take an instance in main function and don't use getx
The authentication service I don’t think you can do that, BUT you usually store more user information in firestore. So you can store what type of user they are and during the login process check that as well, and send them wherever necessary based on that
@@tadaspetra I already added role info in firestore but I dont know where to check the role during login I'm just a beginner .. return GetX( initState: (_) async { Get.put(UserController()); }, builder: (_) { if (Get.find().user?.uid != null) { return AdminView(); } else { return LoginView(); } } ); }
Александр Иванов I don't know if there's much more to it then what I covered in "GetX Other Features" video. Is there something else you would like to know about it
@@tadaspetra I tried that, but getting a missing plugin exception with respect to Firebase Auth, I assume because it's called from inside the controller. I know we must set up Firebase before testing any code that depends on it, haven't yet found any info on how to set up Firebase auth
@@yulkin2002 ah yes. Testing shows a lot of architecture problems. I guess the architecture I was showing was not too good haha. Firebase dependencies should be passed into the controller to help with encapsulation. Then you can mock Firebase Auth 😊
@@tadaspetra on a second thought, since we use stateless widgets, do we really want to initialize Firebase auth in the screen widget code? I would think not, since it will only be used inside the controller. If not inside the widget, what's the appropriate place to initialize auth and pass it into the controller? EDIT: I think the way to go would be bindings? Found this nice example: github.com/jonataslaw/getx/issues/757
I think the discord link might not be working, invite expired for me anyway, looking forwards to the live streams bit late for me so will need to tune in next morning
This is just awesome !!! please don't stop the GetX series
Faisal Al Bahli I don’t know how much else there is to do, but I’ll probably be using it for some projects
I usually don't comment but jesus man you are amazing. No BS, filler crap or anything, straight to the point. Also cannot thank you enough for not using a complicated UI so we see what's actually going on.
Thank you so much! That is what I aim to do in every video. And for me it also makes it a lot simpler using easy UIs because the logic doesn’t get lost in ther e
it would be awesome if you could remake this whole tutorial with the updated information... i'm kind of lost
fyi just to update everyone: FirebaseUser is now User. And you must instantiate not just Rx firebaseUser... While using a GetxController on a class, and using Rx to get a FirebaseUser , you'll be shown an error, that you are missing a positional argument! Use this instead: Rxn firebaseUser = Rxn();
Awesome video. Loved it. Keep up the great work 🔥
Thank you so much
Perfect and clean
Thank you 😊
I don't get the error "AuthController deleted from memory" is for any new update on getX library or something like that?
Hi there, thanks for this nice video.
Two questions, why onAuthStateChanged and not .userChanges()? and why lazyPut?
Great, thanks!
j heisler thank you. Appreciate it!
Can you update this serie please
You should do GetX pattern and authentication with bindings and dependencies injection
Roberto Ortis ya I've been meaning to take a look at GetX pattern. But do you have an example of authentication with bindings and DI
@@tadaspetra I am currently working on an example but can't get the authentication controller to run before GetMaterialApp without running into an error where the controller is not found. I followed a tutorial from another RUclipsr but he does the authentication through a Splash screen (which I don't like). I can send you the link to the RUclipsr videos I just mentioned but it's in spanish. Let me know. I am still working on my own example and will let you know if I get it fixed.
Roberto Ortis I probably won't understand it if it's Spanish haha. But yea definetely send me your example if your figure it out 😊
@@tadaspetra I just got it working. I will let you know when I upload it to github.
I really liked getx, but still have one question about the right architecture for that package. Because it can fit to mvc and mvvm, but there are a few pretty uncomfortable moments when you try to build this type of architecture in your app. Is it a nice practice to connect one controller to e.g 2 viems?
Everythings was work fine but yesterday I migrate the Flutter version to the latest one Flutter 2.2 (stable)and dart SDK version to 2.13(stable). After migration, I get an error on the auth_controller file.
Rx _user = Rx(); in that line, it says 1 positional argument(s) expected, but 0 found. Any one help me please!😐
@Kyden What does Rxn do? compare to Rx
@Kyden Rxn requires null-safety. gotcha
@Kyden Thanks!
Hii Bro, i run this code but shows error =>
*1.Too few positional arguments: 1 required, 0 given.
Rx _firebaseUser = Rx(); @AuthController.
*2. The getter 'documentID' isn't defined for the type 'DocumentSnapshot'.
Try importing the library that defines 'documentID', correcting the name to the name of an existing getter, or defining.. @UserModel
Please give me a solution Bro..
same problem :(
did u figured out the solution for _firebaseUser? I still don't find how to initialize, and I don't know what argument Rx wants.
@@viniciusgregorio1412 i will send error file(image)..? How to connect you sir..
@@viniciusgregorio1412 same here , did u figure it out ?
@@yasserharzelli7984 yes, call me on discord Skyzitcho#2024
Great , did you think before if you want pass an a argument in controller constructor and defined it 'controller' before widget builder not wrap a widget builder with GetX or GetBuilder!
String? get user {
return _firebaseUser.value?.email;
}
User only updates with new user creation not with login, How to solve
6:37 - 9:05 what is the reason for doing that( I mean extend by GetWidget ). I have never seen this
GetWidget allows you to access controller by simply writing the keyword controller else you have to initialize the controller by sth like Get.put or Get.find manually.
In the documentation it says "The use case [of GetWidget] is very rare, but very specific" but in this app we are using it for every screen. I feel like this is not intended. Correct me if I'm wrong.
So at the time of writing this, GetView and GetWidget were identical. Maybe that has changed, or maybe the recommended options is GetView now
@@tadaspetra Got it, thanks for clarifying.
For those having problem with e.message ,
Problem solved by adding "on FirebaseAuthException" before "catch" and converting "e.message" to "e.message.tostring()"
Full Code:
void createUser(String email, String password) async {
try {
await _auth
.createUserWithEmailAndPassword(email: email, password: password)
.then((value) => Get.offAll(Home()));
} on FirebaseAuthException catch (e) {
Get.snackbar("Error while creating account", e.message.toString(),
snackPosition: SnackPosition.BOTTOM);
}
}
Why does the app not log out when you are doing logout() from another screen, I understand the Obx as observing the stream, and reacting to it. Is it not supposed to return Login() when I am down the widget tree, in say "profile" screen. I am coming from a provider mindset where a stream in main.dart use to do this.
I have an app where I was using Provider in a stateful login widget. Is there a tutorial for that?
I don’t have one exactly for that. But I do have a playlist for provider
Why do we want our user to be observeable if I doesn't need to appear on the UI and Can you make a verification for the email.
It's so seamless
I still didn't understand how the Get.back() works in signup. As of my understanding if the user authstate changes then the obx code will run and it will re-run the root code. Isn't it enough to update the user to the home screen, even he is logged from the signup screen?
Please reply.
hello sir, it was so wonderful and nice tutorial. btw i wonder authcontroller can detect one user per one device???
For having an initialBinding in my GetMaterialApp, is it possible to place multiple unique controllers inside one binding? Since my project needs like ~15 controllers, which (almost all) need to be loaded at the start of the application and display fetched data in a dashboard-kind-of-home-page.
Yes, should definitely be possible. There is nothing stopping you from initializing 10000 controllers in a binding.....except maybe the processor power 😂
Would love to see you make a tutorial for an full fledge expense tracking application!!
Good Suggestion! I'll put it on my list. The next two things I want to try is a Flutter website, and then a chat app!
Wow!!
@@tadaspetra When chat app coming brother?
Please use GetX, and more importantly Realtime Database for chat functionality because in real world scenario RTDB is about 5 times cheaper than Firestore for chatting.
Can we use GetxService for Auth service instead of creating the root widget to redirect the user ?
Dear sir, when I try to do this I got an error
" The getter 'email' was called on null.
Receiver: null
Tried calling: email "
and I still cannot fix it. Any help me please.
thanks in advance!
is it solved?
first
I think i saw your new tutorial on youtube the firebase getx Todo App the new version. But now I think it is missing.......
I made one on freecodecamp. But it wasn’t using GetX 😊. I promise I haven’t removed anything haha
For Google Sign in , how to hide the login page if a user is already logged in? Can u make a separate video for google sign in too?
It should be very similar. Firebase Auth provides the data for what use is authenticated, it doesn't matter whether it's from GoogleSignIn or normal. And in the book club series we added google sign in, so you can take a look there too
please make a video on making shop purchase receipt and pdf printing
That’s a very specific thing. But I’ll see if I can add it in somewhere ☺️. Thanks for the suggestion
I didn't expect that u'd be interested! Thanks!
It shows me an error " the method bindStream was called on null ?
did you figured it out? same here
@@viniciusgregorio1412 yeah it had something to do with get version use this version ^3.26.0 it will fix it or take an instance in main function and don't use getx
@@yomna_mi tyyyyy
may i know, why you make obx in root.dart
FunGuardian so if the authentication state changes it will move you to a different screen 😊
@@tadaspetra wow, thx a lot for replying
FunGuardian no problem! 😊
Hi! Tadas, How can i make this a role base login with 3 types of user [admin,collector,user]? im stuck with this .. Thank you!
The authentication service I don’t think you can do that, BUT you usually store more user information in firestore. So you can store what type of user they are and during the login process check that as well, and send them wherever necessary based on that
@@tadaspetra I already added role info in firestore but I dont know where to check the role during login I'm just a beginner ..
return GetX(
initState: (_) async {
Get.put(UserController());
},
builder: (_) {
if (Get.find().user?.uid != null) {
return AdminView();
} else {
return LoginView();
}
}
);
}
@@markkevingatchalian4348 Whenever you are calling the authentication, you can check it right after you get authenticated
please make video about binding.
Александр Иванов I don't know if there's much more to it then what I covered in "GetX Other Features" video. Is there something else you would like to know about it
hi Tadas, how would you test this code? I'm really at a loss when it comes to testing GetX controllers
It is similar to testing any other state management. You can just load the state in manually, and then run the test relying on that state
@@tadaspetra I tried that, but getting a missing plugin exception with respect to Firebase Auth, I assume because it's called from inside the controller. I know we must set up Firebase before testing any code that depends on it, haven't yet found any info on how to set up Firebase auth
@@yulkin2002 ah yes. Testing shows a lot of architecture problems. I guess the architecture I was showing was not too good haha. Firebase dependencies should be passed into the controller to help with encapsulation. Then you can mock Firebase Auth 😊
@@tadaspetra ah I see, let me give this a try. thanks :)
@@tadaspetra on a second thought, since we use stateless widgets, do we really want to initialize Firebase auth in the screen widget code? I would think not, since it will only be used inside the controller. If not inside the widget, what's the appropriate place to initialize auth and pass it into the controller?
EDIT: I think the way to go would be bindings? Found this nice example: github.com/jonataslaw/getx/issues/757
I think the discord link might not be working, invite expired for me anyway, looking forwards to the live streams bit late for me so will need to tune in next morning
you are right! Its updated now in the descripition to discord.gg/CPwSezC
I didn't know they expired lol
@@tadaspetra cheers joined 😁
Hi! Can anyone tell me how to use the initState in GetBuilder?
class BestDeals extends StatelessWidget {
@override
Widget build(BuildContext context) {
bool isCalled = false;
return GetBuilder(
init: ProductController(),
builder: (_) {
if(!isCalled){
_.getBestDeals();
isCalled = true;
}
return AppBackground(
child: _.bestDeals.isNotEmpty
? StaggeredGridView.countBuilder(
crossAxisCount: ScreenSize.getWidth(context: context) < 360 ? 1 : 2,
crossAxisSpacing: 5.0,
mainAxisSpacing: 5.0,
itemCount: _.bestDeals.length,
padding: EdgeInsets.all(5),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return ProductCard(
productDetails: _.bestDeals[index]
['product_details'],
productQuantities: _.bestDeals[index]
['product_quantity'],
);
},
staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
)
: SpinKitFadingCircle(
color: Colors.white,
size: 50.0,
),
);
}
);
}
}
How to implement this code in a better way?
You are doing great but you need to improve your video quality
Evans Addo how so?