watchAsState

@ApolloExperimental
fun <D : Query.Data> ApolloCall<D>.watchAsState(context: CoroutineContext = EmptyCoroutineContext): State<ApolloResponse<D>?>

Returns a State that produces ApolloResponses by watching this ApolloCall. The initial value is null, which can be used to mean 'waiting for the first value'. ApolloResponse.exception can be used to check for ApolloExceptions thrown during execution. Example:

    val response by apolloClient.query(MyQuery()).watchAsState()
when {
response == null -> Loading()
response!!.exception != null -> NetworkError(response!!.exception!!)
response!!.hasErrors() -> BackendError(response!!.errors!!)
else -> Screen(response!!.data!!)
}