Jun 29, 2022
For the record, a race condition can only happen if multiple threads try to update the StateFlow at the same time using a non-atomic operation, which is not the case in your example because viewModelScope always uses the main thread (unless you explicitly override the dispatcher).