Hey folks, is it a bad practice to get the Fragmen...
# koin
f
Hey folks, is it a bad practice to get the Fragment's Presenter (MVP arch) lazily via
by inject
like this:
private val presenter: MySamplePresenter by inject { parametersOf(requireContext(), get()) }
at the top of the Fragment? (not in lifecycle events like onViewCreated etc). Is this gonna cause a memory leak on screen rotation? (cause then fragment is retained during configuration change but view is destroyed and recreated)
a
Your presenter shouldn’t be retained if declared as factory
👍 1
t
The
requireContext()
part might raise some issues. Try to use
androidContext()
within your factory instead. Or maybe try to not use a context within your presenter...
👍 1