Git Product home page Git Product logo

Comments (2)

jonataslaw avatar jonataslaw commented on May 17, 2024

Its implementation is totally correct! Are you experiencing any problems with this or just want to confirm that you are doing everything right? Everything seems to be ok for me, and even following good practices.

Personally use SchedulerBinding.instance instead of WidgetsBinding.instance, because it allows you to listen to the end of the build method outside a Stateful and create a "SplashScreen" screen (similar to your authentication screen) to be more user friendly and display a loading, and put all authentication logic in my class's controller.
I also use modular, and my approach is no more correct than yours, maybe it's a different, but equivalent standard, and your logic is correct.
Even though you were a beginner, you managed to do everything correctly. I just wouldn't use SystemNavigator.pop(); because I’ve already had apps rejected on the AppleStore for "unexpected app exit". Test this first on iOS, and see that there is backGesture, and if it makes the app exit, if so, change your code to:

if (! Get.key.currentState.canPop () && GetPlatform.isAndroid) {
      SystemNavigator.pop();
 }

In android this behavior is expected, but in iOS it goes against human guidelines, and you can face problems.

If your application is only android, there is no need to follow this tip.
If your application has a web/PWA version, don't use Flutter's Platform.isAndroid, it imports Dart: io which is incompatible with the WEB (I had to create GetPlatform precisely to give full web support, and I left this Get API exposed for those who need to use it).

from getx.

fabriciovergara avatar fabriciovergara commented on May 17, 2024

Thanks for your feedback, I'll take a look in this SchedulerBinding documentatio - I was trying to find something like that, but WidgetBinding was looking too much as ViewLayer stuff to put in the Controller/ViewModel

And yes, i just wanted to confirm if this approach is correct using your library.

I have to add this SystemNavigator.pop() because after user press back from /home it's redirect to this empty screen, that shouldn't be visible in this time being considering /home /login as the first item of the navigation stack, I just wanted to close the app when reach this point.

Tried to handle with RouteObserver instead of listening a Future, but for some reason it wasn't been called when I get back to / path, was trying to read the source code, but haven't found the reason yet.

Edit: Acabei de ver que voce tem um repositorio em portugues.
Muito obrigado pelas dicas e por esta biblioteca :)

from getx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.