Search code examples
androidkotlinkotlin-coroutinesreactive-streams

Reactive Publisher openSubscription become obsolete in the future, how should I fix it?


I used the Rx Publisher and try to convert the publisher to coroutine flow in android app. But I got the following message of the used function openSubscription() But I cant find any replacement for this function.

This declaration is experimental and its usage should be marked with '@kotlinx.coroutines.ObsoleteCoroutinesApi' or '@OptIn(kotlinx.coroutines.ObsoleteCoroutinesApi::class)'

publisher.openSubscription().receiveAsFlow()

Appreciate for any comment or advice


Solution

  • The documentation has stated the alternative to openSubscription() use asFlow() check the docs here