Progress

class Progress(fraction: Float?, val phase: String? = null)

One progress report: how far the operation is (fraction) and what it does now (phase).

Both values live in one object, so a progress bar never shows the fraction of one report with the label of another. You read it from ProgressFuture.progress. You construct it yourself only for withProgress.

Progress(0.42f, "pages")   // toString(): "Progress(42%, pages)"
Progress(null) // toString(): "Progress(indeterminate)"

The constructor never throws. A fraction outside 0..1 is clamped, and NaN becomes null. Two reports with equal values are equal, so a StateFlow does not wake its collectors for a repeated report.

Parameters

fraction

the done part of the work, from 0f to 1f, not a percent. null means the total is not known yet (an indeterminate bar).

Constructors

Link copied to clipboard
constructor(fraction: Float?, phase: String? = null)

Properties

Link copied to clipboard

The done part of the work in 0..1, or null while the total is not known.

Link copied to clipboard

a short label for the current step, such as "parsing", or null.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String