Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    robr
    @RodBr
    robr
    @RodBr
    is there any way to do a lazy instantiation that will keep the controller from ever being destroyed? I want to create services at app launch, but because they have dependencies on each other the Get.finds fail as the objects are being created before GetMaterialApp.
    BTW, I already asked this in jonataslaw/get#188, so it's a repeat question
    Jonny Borges
    @jonataslaw
    @RodBr The issue with onInit called only once using SmartManagement.onlyBuilder introduced by 2.12.0 has been fixed in version 2.12.1
    robr
    @RodBr
    thanks @jonataslaw
    I'm trying to do some initial processing when I instantiate a new page/controller
    '''return GetX<SettingsController>(
    init: SettingsController(),
    // initState: _getUser(),
    initState: _user = SettingsController.to.getUser(), '''
    but the initState fires before the controller is instantiated
    any suggestions on how to do some initial processing before I start building the page, but after the controller is built?
    robr
    @RodBr
    I've also removed lazyPut of any service used throughout my App and replaced it with standard put with permanent: true.
    Otherwise the services were being removed when the page where the service was first used is removed.
    robr
    @RodBr
    And had to move them out of main and create them all with an init method
    does this sound like the right way to do this?
    Jonny Borges
    @jonataslaw

    Are you using SmartManagement.onlybuilder?

    I'll pass that line down in the next update

    if (widget.initState != null) widget.initState(this); // this
    if (isCreator && Get().smartManagement == SmartManagement.onlyBuilder) {
    controller?.onInit();
    }

    Well, maybe allowing so many different paths has become confusing, but basically you can use Get in 4 different ways.

    1- Initialize each controller in its init and use SmartManagement as onlyBuilder.
    2- Initialize everything in Bindings and use the standard SmartManagement.
    3- Use Get.put and Get.find within View to find and make Controllers available.
    4- Create a unique Binding with and initialize them in initialBinding in GetMaterialApp together with SmartManagement.keepFactory

    robr
    @RodBr
    for now i've left smartManagement as the default
    and just created a method to start all of the services in a startup view/controller
    void setupServices() {
      Get.lazyPut<AuthService>(() => AuthService());
      Get.lazyPut<FirebaseService>(() => FirebaseService());
      Get.lazyPut<FirestoreService>(() => FirestoreService());
      Get.lazyPut<NotificationService>(() => NotificationService());
      Get.lazyPut<ThemeController>(() => ThemeController());
    }
    
    void startServices() {
      Get.find<AuthService>();
      Get.find<FirebaseService>();
      Get.find<FirestoreService>();
      Get.find<NotificationService>();
    }
    robr
    @RodBr
    I could have just used Get.put in startServices, but since some of the services have dependencies on each other this takes away the need to get the order of instantiation right
    robr
    @RodBr
    if this causes an issue i'll switch back to Get.puts with permanent flag set
    Jonny Borges
    @jonataslaw
    robr
    @RodBr
    @jonataslaw the latest changes look interesting, looking forward to what 3.0 brings
    Jonny Borges
    @jonataslaw
    Great article!
    robr
    @RodBr
    I've just dug through the latest updates, I don't think they affect the article
    Sebastian Montoya
    @joanofdart
    :o!
    Sorry about posting the "Issues" before, didnt know we have gitter :)
    Sebastian Montoya
    @joanofdart
    Getting this issue right now :O Exception has occurred.
    NoSuchMethodError (NoSuchMethodError: The getter 'route' was called on null.
    Receiver: null
    Tried calling: route)
    when using Get.offNamedUntil
    robr
    @RodBr
    hi Sebastian, I'm not seeing anything. Do you have more info?
    Sebastian Montoya
    @joanofdart
    I think the issue is more towards that I'd like to have a root view with a root controller to automatically redirect the user to either login or home based on its current auth.
    does anyone has an idea on how that's done? think I've already got most of it done (I'd like to think) but I'm still not there yet, heres what i've got....
    
    class StartUpController extends RxController {
      final authenticationService = Get.find<AuthenticationService>();
      final isUserLoggedIn = false.obs;
    
      @override
      void onInit() {
        ever(isUserLoggedIn, fireRoute);
        // authenticationService.currentUserStream.listen((event) => print(event)).obs;
        isUserLoggedIn.value = authenticationService.currentUserStream.obs.value != null ? true : false;
        print('onInit ${isUserLoggedIn.value}');
      }
    
      fireRoute(logged) {
        print('fireRoute $logged');
        if (logged) {
          Get.off(HomeView());
        } else {
          Get.off(LoginView());
        }
      }
    }
    Should I just use provider to accomplish this? tho I'd like to just rely on Get
    Jonny Borges
    @jonataslaw
    Did you exchange your MaterialApp for GetMaterialApp?
    Sebastian Montoya
    @joanofdart
    I did
    I'm quite confused with setting a "root" view which handles a stream (like the firebase.onAuthStateChanged) and redirect the user to either X o Y view depending on the value (if authed or not)
    Sebastian Montoya
    @joanofdart
    The lack of documentation and samples its a big demotivation :/
    Katekko
    @Katekko

    @joanofdart You are already in my discord, but anyone that need help, just come and ask. Will be a pleasure help you in your development (in my free time)

    https://discord.gg/bb88Bud

    Nipodemos
    @Nipodemos
    hey, i don't usually come here, but i though that this was not big enough to make a new issue
    When you put new docs about new stuff you make, could you please put the docs also in readme's of the other languages?
    put in english, not a problem
    it is better to have a doc in english then don't have
    also it is easier to update later :sweat_smile:
    jhonattanS
    @jhonattanS
    Hello, i update to version 3.2.1, and i noticed cupertino has the same transition of cupertinoDialog transition. I thought it was better to warn here than to create an issue.
    Stefan de Vogelaere
    @stefandevo
    Renan
    @renancaraujo
    So queria passar pra dizer obrigado por ter criado isso
    Jonny Borges
    @jonataslaw
    Poxa Renan, eu fico feliz em ouvir isso de você que é um dos maiores contribuidores da comunidade, suas bibliotecas de visualização e de manipulação de imagem já me pouparam muito trabalho, e sou muito grato por suas contribuições
    ultrahabitat
    @ultrahabitat
    My Flutter/AndroidStudio/firebase is broken when I try to update firebase. I have tried all of the firebase/firestore recommended settings from google and I still get.
    The following _TypeError was thrown building GetMaterialApp:
    type '_BroadcastStream<User>' is not a subtype of type 'Stream<FirebaseUser>'
    jardelsobrinho
    @jardelsobrinho
    Em primeiro lugar gostaria de dar os parabéns por essa incrível lib. Com ela ficou muito mais fácil e intuitivo desenver em flutter. Ficou mais fácil gerenciar e aplicar os padrões de projeto. Você está fazendo um ótimo trabalho.
    Tenho uma dúvida sobre a injeção de dependência. Como faço para adicionar na injecao uma classe que possui como parâmetros outro classe em seu construtor. Exemplo, tem duas classes A e B. No construtor da classe B eu tenho que passar a classe A. Como seria feita essa configuração? Hoje eu uso o Get it para gerenciar as dependências, mas estou querendo usar apenas a Getx
    rutvik110
    @rutvik110
    Can anyone share the discord link?