Hi, can someone explain the `runOnCreate` method? ...
# orbit-mvi
r
Hi, can someone explain the
runOnCreate
method? Is it always required? I am writing tests for my viewmodels on android.
a
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
Quick question about this, when does the on create block get run usually? Right after the container gets created?
a
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