Created
December 21, 2025 11:41
-
-
Save ghasemdev/d21d1726a4f0dcf03b851a1bb956ca1f to your computer and use it in GitHub Desktop.
fakeFlow
This file contains hidden or 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
| import kotlinx.coroutines.delay | |
| import kotlinx.coroutines.flow.Flow | |
| import kotlinx.coroutines.flow.flow | |
| fun fakeUserResultsFlow(): Flow<UserResult> = flow { | |
| val fakeData = listOf( | |
| UserResult( | |
| nationalId = "1234567890", | |
| phoneNumber = "+989121234567", | |
| isWinner = false | |
| ), | |
| UserResult( | |
| nationalId = "0987654321", | |
| phoneNumber = "+989351112233", | |
| isWinner = true | |
| ), | |
| UserResult( | |
| nationalId = "1122334455", | |
| phoneNumber = "+989191234999", | |
| isWinner = false | |
| ), | |
| UserResult( | |
| nationalId = "1234567890", | |
| phoneNumber = "+989121234567", | |
| isWinner = false | |
| ), | |
| UserResult( | |
| nationalId = "0987654321", | |
| phoneNumber = "+989351112233", | |
| isWinner = true | |
| ), | |
| UserResult( | |
| nationalId = "1122334455", | |
| phoneNumber = "+989191234999", | |
| isWinner = false | |
| ), | |
| UserResult( | |
| nationalId = "1234567890", | |
| phoneNumber = "+989121234567", | |
| isWinner = false | |
| ), | |
| UserResult( | |
| nationalId = "0987654321", | |
| phoneNumber = "+989351112233", | |
| isWinner = true | |
| ), | |
| UserResult( | |
| nationalId = "1122334455", | |
| phoneNumber = "+989191234999", | |
| isWinner = true | |
| ) | |
| ) | |
| for (item in fakeData) { | |
| delay(500) | |
| emit(item) | |
| } | |
| } |
This file contains hidden or 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
| data class UserResult( | |
| val nationalId: String, | |
| val phoneNumber: String, | |
| val isWinner: Boolean | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment