

Per-subscribe Hooks.onLastOperator(, ? extends >). Userīe passed to this "subscribe" extension but will loose the available Subscribe(Subscriber) used internally for Context passing. Subscribe(CoreSubscriber) is an internal extension to


Should be avoided, as these may be shared between several Subscribers. Note that using state in the / lambdas used within Flux operators If it is known that the underlying Publisher will emit 0 or 1 element, Mono should be used It is intended to be used in implementations and return types. Learning more about individual operators). Through the reference documentation, rather than through this javadoc (as opposed to The recommended way to learn about the Flux API and discover new operators is If (currentState != State.CONNECTED) throw IllegalStateException("The connection is lost.A Reactive Streams Publisher with rx operators that emits 0 to N elements, and then completes Ws.closeSocket(1000, "The user has closed the connection.") Throw IllegalStateException("The socket is available.") Var messageListener: ((msg: String) -> Unit)? = null Var stateListener: ((State) -> Unit)? = null Internal actual class PlatformSocket actual constructor(url: String) Īnd here is the common logic in the common module that uses the platform-specific class PlatformSocket(). However, in your Gradle build files, you need to use a specific target name from the list of supported targets. Examplesįor simplicity, the following examples use intuitive target names, like iOS and Android. Learn how to add dependencies on platform-specific libraries. Implementing as much functionality as possible in the shared module is better, even if doing so takes more time.ĭon't overuse expected and actual declarations – in some cases, an interface may be a better choice because it is more flexible and easier to test.

Use expected and actual declarations only for Kotlin declarations that have platform-specific dependencies. The IDE provides tools that help you create the missing actual declarations. The compiler ensures that every declaration marked with the expect keyword in the common module has the corresponding declarations marked with the actual keyword in all platform modules. This works for most Kotlin declarations, such as functions, classes, interfaces, enumerations, properties, and annotations. With this mechanism, a common source set defines an expected declaration, and platform source sets must provide the actual declaration that corresponds to the expected declaration. If you're developing a multiplatform application that needs to access platform-specific APIs that implement the required functionality (for example, generating a UUID), use the Kotlin mechanism of expected and actual declarations. We'll do our best to minimize any changes you will have to make. It is almost stable, but migration steps may be required in the future.
