How can I call flow method from Java code.
fun getAllUsers(): Flow<List<User>> =
userRepositoryImpl.getAllUsers()
from Java
private Observable<List<User>> getUsers() {
subscriber.onNext(userViewModel.getAllUsers()); //example
}
How can I call flow method from Java code.
fun getAllUsers(): Flow<List<User>> =
userRepositoryImpl.getAllUsers()
from Java
private Observable<List<User>> getUsers() {
subscriber.onNext(userViewModel.getAllUsers()); //example
}
If what you want to do is collecting a flow, you can do like this.
Define coroutine helper functions in a Kotlin file.
then In Java, you can call collectInJava to collect a flow.