Firebase Auth with GetX | Todo App

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 103

  • @faisalbahli
    @faisalbahli 4 года назад +4

    This is just awesome !!! please don't stop the GetX series

    • @tadaspetra
      @tadaspetra  4 года назад +1

      Faisal Al Bahli I don’t know how much else there is to do, but I’ll probably be using it for some projects

  • @Septix
    @Septix 3 года назад

    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.

    • @tadaspetra
      @tadaspetra  3 года назад +1

      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

  • @josueorozcoaltamirano7101
    @josueorozcoaltamirano7101 3 года назад +9

    it would be awesome if you could remake this whole tutorial with the updated information... i'm kind of lost

  • @Juliapak
    @Juliapak 2 года назад

    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();

  • @vishnuprasadh7692
    @vishnuprasadh7692 4 года назад +1

    Awesome video. Loved it. Keep up the great work 🔥

  • @JonAndroide
    @JonAndroide 4 года назад +4

    I don't get the error "AuthController deleted from memory" is for any new update on getX library or something like that?

  • @fedorstepanov3731
    @fedorstepanov3731 3 года назад +2

    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?

  • @lubshadpattarathil280
    @lubshadpattarathil280 4 года назад +1

    Perfect and clean

  • @poisonels8023
    @poisonels8023 3 года назад +2

    Can you update this serie please

  • @rodrodrigues1729
    @rodrodrigues1729 Год назад

    Hi there, thanks for this nice video.
    Two questions, why onAuthStateChanged and not .userChanges()? and why lazyPut?

  • @RobertoOrtis
    @RobertoOrtis 4 года назад +3

    You should do GetX pattern and authentication with bindings and dependencies injection

    • @tadaspetra
      @tadaspetra  4 года назад

      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

    • @RobertoOrtis
      @RobertoOrtis 4 года назад +1

      @@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.

    • @tadaspetra
      @tadaspetra  4 года назад +1

      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 😊

    • @RobertoOrtis
      @RobertoOrtis 4 года назад +3

      @@tadaspetra I just got it working. I will let you know when I upload it to github.

  • @DreamBigEducation
    @DreamBigEducation 3 года назад +3

    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..

    • @__eugene_choi
      @__eugene_choi 3 года назад +1

      same problem :(

    • @viniciusgregorio1412
      @viniciusgregorio1412 3 года назад +1

      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.

    • @DreamBigEducation
      @DreamBigEducation 3 года назад

      @@viniciusgregorio1412 i will send error file(image)..? How to connect you sir..

    • @yasserharzelli7984
      @yasserharzelli7984 3 года назад

      @@viniciusgregorio1412 same here , did u figure it out ?

    • @viniciusgregorio1412
      @viniciusgregorio1412 3 года назад

      @@yasserharzelli7984 yes, call me on discord Skyzitcho#2024

  • @wizzl8513
    @wizzl8513 4 года назад +1

    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.

    • @tadaspetra
      @tadaspetra  4 года назад

      So at the time of writing this, GetView and GetWidget were identical. Maybe that has changed, or maybe the recommended options is GetView now

    • @wizzl8513
      @wizzl8513 4 года назад +1

      @@tadaspetra Got it, thanks for clarifying.

  • @jrheisler
    @jrheisler 4 года назад +1

    Great, thanks!

    • @tadaspetra
      @tadaspetra  4 года назад

      j heisler thank you. Appreciate it!

  • @shoiburrahmankhansifat7176
    @shoiburrahmankhansifat7176 3 года назад +2

    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!😐

    • @이승현-c2r
      @이승현-c2r 3 года назад +1

      @Kyden What does Rxn do? compare to Rx

    • @이승현-c2r
      @이승현-c2r 3 года назад +1

      @Kyden Rxn requires null-safety. gotcha

    • @이승현-c2r
      @이승현-c2r 3 года назад +1

      @Kyden Thanks!

  • @nudgecodes7471
    @nudgecodes7471 4 года назад

    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!

  • @darshshah5051
    @darshshah5051 4 года назад +1

    Would love to see you make a tutorial for an full fledge expense tracking application!!

    • @tadaspetra
      @tadaspetra  4 года назад +2

      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!

    • @darshshah5051
      @darshshah5051 4 года назад +1

      Wow!!

    • @shubhammittal9764
      @shubhammittal9764 4 года назад

      @@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.

  • @akhilksugathan
    @akhilksugathan 3 года назад +1

    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);
    }
    }

  • @이제영-n5b
    @이제영-n5b 3 года назад

    hello sir, it was so wonderful and nice tutorial. btw i wonder authcontroller can detect one user per one device???

  • @akhilksugathan
    @akhilksugathan 3 года назад

    String? get user {
    return _firebaseUser.value?.email;
    }
    User only updates with new user creation not with login, How to solve

  • @wesleybarnes5376
    @wesleybarnes5376 3 года назад

    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.

  • @nijojoseph
    @nijojoseph 4 года назад +1

    ​ I think i saw your new tutorial on youtube the firebase getx Todo App the new version. But now I think it is missing.......

    • @tadaspetra
      @tadaspetra  4 года назад

      I made one on freecodecamp. But it wasn’t using GetX 😊. I promise I haven’t removed anything haha

  • @thestacksdev
    @thestacksdev 3 года назад

    It's so seamless

  • @ssn1057
    @ssn1057 4 года назад +1

    please make a video on making shop purchase receipt and pdf printing

    • @tadaspetra
      @tadaspetra  4 года назад

      That’s a very specific thing. But I’ll see if I can add it in somewhere ☺️. Thanks for the suggestion

    • @ssn1057
      @ssn1057 4 года назад +1

      I didn't expect that u'd be interested! Thanks!

  • @deepL0
    @deepL0 2 года назад

    6:37 - 9:05 what is the reason for doing that( I mean extend by GetWidget ). I have never seen this

    • @TechnoDB
      @TechnoDB 2 года назад +1

      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.

  • @TimKariuki
    @TimKariuki 4 года назад +1

    I have an app where I was using Provider in a stateful login widget. Is there a tutorial for that?

    • @tadaspetra
      @tadaspetra  4 года назад

      I don’t have one exactly for that. But I do have a playlist for provider

  • @sowmyancs
    @sowmyancs 3 года назад

    Can we use GetxService for Auth service instead of creating the root widget to redirect the user ?

  • @Hypothermia1337
    @Hypothermia1337 4 года назад

    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.

    • @tadaspetra
      @tadaspetra  4 года назад +1

      Yes, should definitely be possible. There is nothing stopping you from initializing 10000 controllers in a binding.....except maybe the processor power 😂

  • @akhilksugathan
    @akhilksugathan 3 года назад

    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.

  • @congtoannguyen1940
    @congtoannguyen1940 3 года назад

    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.

  • @mitzukodavis7393
    @mitzukodavis7393 4 года назад +1

    first

  • @chendaoeun8381
    @chendaoeun8381 3 года назад

    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!

  • @saransundaresanmadhavan810
    @saransundaresanmadhavan810 3 года назад

    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?

    • @tadaspetra
      @tadaspetra  3 года назад

      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

  • @yulkin2002
    @yulkin2002 4 года назад

    hi Tadas, how would you test this code? I'm really at a loss when it comes to testing GetX controllers

    • @tadaspetra
      @tadaspetra  4 года назад

      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

    • @yulkin2002
      @yulkin2002 4 года назад +1

      @@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

    • @tadaspetra
      @tadaspetra  4 года назад

      @@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 😊

    • @yulkin2002
      @yulkin2002 4 года назад +1

      @@tadaspetra ah I see, let me give this a try. thanks :)

    • @yulkin2002
      @yulkin2002 4 года назад

      @@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

  • @АлександрИванов-ю8с8г

    please make video about binding.

    • @tadaspetra
      @tadaspetra  4 года назад

      Александр Иванов 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

  • @elliotjack6999
    @elliotjack6999 4 года назад

    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

    • @tadaspetra
      @tadaspetra  4 года назад +1

      you are right! Its updated now in the descripition to discord.gg/CPwSezC
      I didn't know they expired lol

    • @elliotjack6999
      @elliotjack6999 4 года назад +1

      @@tadaspetra cheers joined 😁

  • @FunGuardian
    @FunGuardian 4 года назад +1

    may i know, why you make obx in root.dart

    • @tadaspetra
      @tadaspetra  4 года назад +1

      FunGuardian so if the authentication state changes it will move you to a different screen 😊

    • @FunGuardian
      @FunGuardian 4 года назад +1

      @@tadaspetra wow, thx a lot for replying

    • @tadaspetra
      @tadaspetra  4 года назад

      FunGuardian no problem! 😊

  • @yomna_mi
    @yomna_mi 3 года назад

    It shows me an error " the method bindStream was called on null ?

    • @viniciusgregorio1412
      @viniciusgregorio1412 3 года назад

      did you figured it out? same here

    • @yomna_mi
      @yomna_mi 3 года назад +1

      @@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

    • @viniciusgregorio1412
      @viniciusgregorio1412 3 года назад

      @@yomna_mi tyyyyy

  • @markkevingatchalian4348
    @markkevingatchalian4348 3 года назад

    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!

    • @tadaspetra
      @tadaspetra  3 года назад

      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

    • @markkevingatchalian4348
      @markkevingatchalian4348 3 года назад

      @@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();
      }
      }
      );
      }

    • @tadaspetra
      @tadaspetra  3 года назад

      @@markkevingatchalian4348 Whenever you are calling the authentication, you can check it right after you get authenticated

  • @aritrachoudhury8409
    @aritrachoudhury8409 4 года назад

    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?

  • @evansaddo2965
    @evansaddo2965 4 года назад +1

    You are doing great but you need to improve your video quality