which one is better to use Sealed class or Enum fo...
# compose-android
m
which one is better to use Sealed class or Enum for the navigation route?
z
Depends if you want to add data to your routes
👍 1
E.g. with sealed class you can do stuff like
Copy code
sealed interface Screen
data class CustomerDetails(val customerId: String): Screen
i
Keep in mind that neither sealed classes or enums are going to be the right tool for the job once you move to multiple modules
z
Depends how your modules and nav are organized. If your navigation is module-local, they can still work
m
@Ian Lake For now I'm now working in multi-module it's my personal app
@Zach Klippenstein (he/him) [MOD] Hmm, so sealed class is much more flexible and can provide more functionality, am I right?
👍🏻 1
j
TIL there are also sealed interfaces not only sealed classes. Makes sense 😅 Directly helps me with a small issue I had last week. gratitude thank you