PagerFlowSnapshotKt

Added in 3.2.0

public final class PagerFlowSnapshotKt


Summary

Public methods

static final @NonNull List<@NonNull Value>
@VisibleForTesting
<Value extends Object> asSnapshot(
    @NonNull Flow<@NonNull PagingData<@NonNull Value>> receiver,
    @NonNull LoadErrorHandler onError,
    @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull SnapshotLoader<@NonNull Value>, Unit> loadOperations
)

Runs the SnapshotLoader load operations that are passed in and returns a List of data that would be presented to the UI after all load operations are complete.

Public methods

@VisibleForTesting
public static final @NonNull List<@NonNull Value> <Value extends Object> asSnapshot(
    @NonNull Flow<@NonNull PagingData<@NonNull Value>> receiver,
    @NonNull LoadErrorHandler onError,
    @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull SnapshotLoader<@NonNull Value>, Unit> loadOperations
)

Runs the SnapshotLoader load operations that are passed in and returns a List of data that would be presented to the UI after all load operations are complete.

Parameters
@NonNull LoadErrorHandler onError

The error recovery strategy when PagingSource returns LoadResult.Error. A lambda that returns an ErrorRecovery value. The default strategy is ErrorRecovery.THROW.

@ExtensionFunctionType @NonNull SuspendFunction1<@NonNull SnapshotLoader<@NonNull Value>, Unit> loadOperations

The block containing SnapshotLoader load operations.