https://kotlinlang.org logo
#orbit-mvi
Title
# orbit-mvi
r

Rak

01/12/2022, 4:46 PM
Hi, can someone explain the
runOnCreate
method? Is it always required? I am writing tests for my viewmodels on android.
a

appmattus

01/12/2022, 5:28 PM
runOnCreate is only necessary if you define something in the containers onCreate and you want it to be executed. by default the test will just start in the initial state and do nothing. runOnCreate will call that onCreate block
b

Benoît

01/13/2022, 10:36 AM
Quick question about this, when does the on create block get run usually? Right after the container gets created?
a

appmattus

01/13/2022, 7:50 PM
the first time something happens in the container, whether that is someone subscribing to one of the flows or calling one of the intents - this does mean though that if neither of these things happen then onCreate won't be called
🙏 1
2 Views