Skip to content

Instantly share code, notes, and snippets.

View burnoo's full-sized avatar

Bruno Wieczorek burnoo

  • Android Developer
  • Wrocław, Poland
  • 17:40 (UTC +02:00)
View GitHub Profile
@burnoo
burnoo / RetryRequest.MD
Last active August 14, 2021 10:31
Kotlin Flow - custom result retry

Kotlin Flow - custom result retry

Maybe I will write article about this

API:

internal fun <T, R> Flow<T>.retryMap(
    map: suspend (T) -> R,
    predicate: suspend FlowCollector<R>.(value: T, result: R, attempt: Int) -> Boolean
): Flow<R> {
    var retryCount = 1