Giter VIP home page Giter VIP logo

Comments (7)

avidraghav avatar avidraghav commented on May 26, 2024

Can you send me the screenshot of the code itself where the Lint is giving warnings?

from mynotes.

NewtonCesarRoncari avatar NewtonCesarRoncari commented on May 26, 2024

of Course

AddTasksVM
Captura de Tela 2022-10-07 às 09 37 30
AllTasksVM
Captura de Tela 2022-10-07 às 09 36 52

from mynotes.

avidraghav avatar avidraghav commented on May 26, 2024

As far as the dispatcher warnings are concerned I believe they are false alarms because dispatcher.main is essentially Dispatcher.Main. Injecting Dispatchers is necessary to make Concerned ViewModel testable.
How you wish to tackle the suspending function should not be called from a different dispatcher warning?

from mynotes.

NewtonCesarRoncari avatar NewtonCesarRoncari commented on May 26, 2024

you don't need a dispatcher in viewModelScope.launch to call a suspend function, I removed the dispatchers and the app worked normally, you can check here ( S6307: Suspending functions should be main-safe )

Captura de Tela 2022-10-07 às 12 41 51
Captura de Tela 2022-10-07 às 12 42 47

Notice that the getTask method doesn't show the dispatcher's lint warning because it doesn't call a suspend function

Captura de Tela 2022-10-07 às 12 42 06

from mynotes.

avidraghav avatar avidraghav commented on May 26, 2024

Try running the tests in AllTasksVMTest class and you will see they will all fail. For writing unit tests for functions which use viewModelScope it's necessary to provide a test dispatcher as Main Looper which is used by Dispatcher.Main is not available for unit tests.
One can also hack the dispatcher by using Dispatcher.setMain but injecting dispatchers is the recommended way.

from mynotes.

NewtonCesarRoncari avatar NewtonCesarRoncari commented on May 26, 2024

Ok, i will not work on dispatchers
but i found a bug when keyboar stays over the sanckbar when the user, dont select a deadline, can i work on this ?

Screenrecorder-2022-10-08-12-13-28-718.mp4

from mynotes.

avidraghav avatar avidraghav commented on May 26, 2024

Yes this looks like a valid issue. Please raise another issue and I'll assign that to you

from mynotes.

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.