Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    jasonlaw
    @jasonlaw
    it works great now! I have been troubled by this for week, really really appreciate your help! Thank you!!!
    Andrious Solutions
    @Andrious
    Good to hear....
    jasonlaw
    @jasonlaw
    Hi Greg, there is a bug in the mxc_application, App class. Strangely, the error only occur in the released apk, running debugging mode under dev is always working fine.
    image.png
    Andrious Solutions
    @Andrious
    I shall look into it right away.
    Andrious Solutions
    @Andrious
    I did make some changes to the latest version of mxc_application to make it not fail so blatantly. However, I suspect you'll still get an error on your side. That's because I believe you're returning a 'null' from the init() function for some reason. It would be either Future<false> or Future<true>, but you'll have to 'step through that code' and determine why it is instead returning null.
    I have uploaded, the latest mxc_application package with these modifications. In the screenshot, I have red arrows where I made the changes and one on the init() function where your own code may be generating a 'null' only when in the release apk.
    image.png
    I suspect now what will happen is your app will not progress any farther once it starts up. It will constantly display the loading screen because, your code is returning 'null' in the init() function for one reason or another. That is what I suspect at this point in time.
    jasonlaw
    @jasonlaw
    Hi Greg, I have the same thought as well when I hit the error, which I have returning null from the init() function. However, I couldn't find it after I have checked the code many times. Really have no clue where the null coming from. Anyway, since this issue can be resolved easily so I would work with the solution, even it could be just a workaround.
    Btw, I have another problem with hot reload.
    I found that when hot reload the view is re-created as intended:
    image.png
    However, the initApp is not called after the recreation of view, since it is responsible in calling the AppController.init, failed to call it may give problem to the app, since most of the state value is reset after the recreation of view.
    image.png
    Do you see this a problem?
    jasonlaw
    @jasonlaw
    End up, I found the main culprit is not in initApp, but the AppView,initState is not called after re-create. It seems the sequence of AppView creation is different when in hot reload. After I added the following code in my AppViewState then I get the correct result.
    image.png
    Sorry, I mean the AppView.Init is not called
    Andrious Solutions
    @Andrious
    image.png
    This code in a controller object you wish to run with every hot reload. Possibly, you have it in the wrong controller? Without making such a change as you did above, simply place whatever code that seems to be necessary to run again with every 'reload' in the 'initState()' of the controller indicated in the screenshot.
    You see, looking at your modifications, the code in the 'init()' is obviously not 'asynchronous operations'. Anything in the 'init()' should return a type of Future<bool>, and yet you've placed in the initState() of the AppView?? I'm sorry, but that doesn't make sense to me.
    image.png
    image.png
    Andrious Solutions
    @Andrious
    image.png
    image.png
    Andrious Solutions
    @Andrious
    Above now is a sequence of screenshots conveying the 'path of execution' for a hot reload. I'm running 'an example app' called ContactsExampleApp. You can see its AppView's init() is being fired with every 'hot reload'. I don't understand the problem you're experiencing.
    jasonlaw
    @jasonlaw
    Hi Greg, thanks for looking into this issue, I have made some small change in your example to reproduce the error.
    image.png
    in _ContactListState:
    image.png
    demo mxc bug.gif
    Hope you are clear now. Thanks!
    jasonlaw
    @jasonlaw
    Hi Greg, one more thing about hot reload which is keep bothering me is it won't going back to the last page. This can be easily reproduced too by navigated to 2nd page and trigger the hot reload from there, like below:
    demo mxc hotreload 2nd page.gif
    Andrious Solutions
    @Andrious
    I've been attempting to run the app copy I received, but I'm receiving a git error I'm not familiar with, "git rev-list --max-count=1 version3" It doesn't know with the argument, 'version3', means: fatal: ambiguous argument 'version3': unknown revision or path not in the working tree.
    Have you encountered this error before?
    jasonlaw
    @jasonlaw
    if you are trying to run the copy I sent to you before, then it could be some of the external package reference has been removed. Anyway, you should be able to reproduce the issue with the mxc_application example.. just some minor changes as I have shown above..
    Andrious Solutions
    @Andrious
    Hi Jason. I found the problem. It's apparent 'the solution' I had first given with version 2.0.0 ( State createState() => App.createVW(); ) was not efficient or effective enough! Admittedly, I didn't like it. I took the day to 'step back' and take the approach I originally intended. It involves only changing 'how' one would start an 'MVC' app:
    image.png
    Thus, in the main.dart, you'd see the difference:
    image.png
    I'll have a demo and the source code available shortly. For example, it's been tested successfully using your demo (debugString = "Value before init()")
    jasonlaw
    @jasonlaw
    Thank you Greg for the fast action! Btw, regarding the "not going back to last page", I believe that is due to the usage of Future builder.
    Andrious Solutions
    @Andrious
    Yes, I would think so. Hot reload restarts the app, and it starts from the beginning. You'd have to write code to tell your app what page it last was.
    mxc_application 3.0.0 is now available.
    Andrious Solutions
    @Andrious
    @jasonlaw I you still using the MVC framework? Is the Hot Reload is still an annoyance?
    jasonlaw
    @jasonlaw
    Hi Greg, I removed the Future Builder from my copy and it works good now. Thanks for the great framework!
    Andrious Solutions
    @Andrious
    @jasonlaw With the removal of the Future Builder, does it go back to the last page when you hot reload? What does the framework now look like? Would you give me a copy of it so I can possibly understand how I could make changes for the better to the framework?
    jasonlaw
    @jasonlaw