This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a [Flow] to a [StateFlow] that automatically starts and stops collection based on the number of collectors. | |
* | |
* This function is particularly useful for efficiently managing state in ViewModels, especially when dealing with | |
* data that needs to be retained across configuration changes but should not continuously consume resources when | |
* there are no active collectors. | |
* | |
* | |
* Usage considerations: | |
* - Prefer this over [stateIn] with [SharingStarted.Lazily] or [SharingStarted.Eagerly] in ViewModels to avoid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mahmoudalim.onboarding_presentation.welcome.composables | |
import androidx.compose.runtime.Composable | |
import androidx.compose.animation.core.* | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.gestures.detectTapGestures | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.size |