Skip to content

captureProgress

Captures calls to report within the given flow and reports them as a new Flow.

Emissions

Each report call inside the initial flow leads to a new emitted value in the downstream flow, with a Progressive.value of null. All emissions in the initial flow leads to a new emitted value in the downstream flow, with the emission as Progressive.value and a Progressive.progress of done.

Captures calls to report within block and reports them as a Flow.

Example

captureProgress {
    report(loading(0.1))
    delay(100)
    report(loading(0.9))
    "It's over"
}

generates the flow containing the elements:

null Loading(10%)
null Loading(90%)
"It's over" Done

Termination

The returned Flow terminates right after block terminates, and the returned value is assumed to be the final expected value.