Davide Giuseppe Farella

03/07/2023, 10:31 PM
Hello people. I prototyped something similar to the Store library (I used the same name for now 😅) to be used in my KMP pet project. It’s decently covered with tests, but, as you can imagine, when dealing with multiple flows, many edge cases get uncovered when you execute the code in a real environment. For this reason, I have to choose between two roads: 1) replace it with Store library, now that it is multiplatform 2) create an open-source library for it and get some feedback/contributions to maintain it more easier I’m not confident in replacing it, as I put much effort into it, and it supports pagination better than Store Here’s a brief snippet
fun getMovie(movieId: MovieId) = Store(
    key = StoreKey<Movie>(movieId),
    refresh = Refresh.WithInterval(3.minutes),
    fetcher = Fetcher.forError { remoteMovieDataSource.getMovieDetails(movieId) },
    reader = Reader.fromSource { localMovieDataSource.findMovieWithDetails(movieId) },
    write = localMovieDataSource::insert
The full snippet with more info in the thread The source here: I’d like to receive some feedback