LoadingState

sealed interface LoadingState

Shared loading lifecycle definitions for WebViewState.

+-----------+  +-------+  +---------+  +------------+
| NotReady | | Ready | | Loading | | LoadingEnd |
+-----+-----+ +---+---+ +----+----+ +------+-----+
| | | |
|----------->| | | native peer becomes available
| | | | Android/iOS: almost immediate
| | | | Desktop: after native attach completes
| | | |
| |---------->| | initial load, loadUrl, refresh,
| | | | goBack, goForward, or redirect
| | | |
| | |------------->| page finished or main-frame error
| | | |
| | | |
| | |<-------------| another navigation starts
| | | |
+-----+-----+ +---+---+ +----+----+ +------+-----+
| NotReady | | Ready | | Loading | | LoadingEnd |
+-----------+ +-------+ +---------+ +------------+

State notes:

  • NotReady is the initial state before the native view is ready.

  • Ready is an initialization barrier. It means "safe to issue the first load", not "the page finished loading".

  • Loading is emitted while the current main-frame navigation is in progress.

  • LoadingEnd represents the terminal result of the current navigation, either success or failure.

After the first load begins, a WebViewState usually alternates between Loading and LoadingEnd. It does not normally return to Ready unless a brand new state instance is created.

Inheritors

Types

Link copied to clipboard
data class Loading(val progress: Float) : LoadingState

The current main-frame navigation is running.

Link copied to clipboard
data class LoadingEnd(val success: Boolean, var reason: String?) : LoadingState

The current main-frame navigation has finished.

Link copied to clipboard
data object NotReady : LoadingState

The native WebView exists logically, but its platform view is not ready yet.

Link copied to clipboard

The native WebView is ready to accept the initial navigation request.