Defers the creation of the geohashStateFlow until needed
This commit is contained in:
@@ -65,7 +65,7 @@ class LocationState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
val geohashStateFlow =
|
val geohashStateFlow by lazy {
|
||||||
hasLocationPermission
|
hasLocationPermission
|
||||||
.transformLatest {
|
.transformLatest {
|
||||||
if (it) {
|
if (it) {
|
||||||
@@ -92,4 +92,5 @@ class LocationState(
|
|||||||
SharingStarted.WhileSubscribed(5000),
|
SharingStarted.WhileSubscribed(5000),
|
||||||
latestLocation,
|
latestLocation,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user