This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:rxdart/rxdart.dart'; | |
abstract class BlocBase { | |
void dispose(); | |
} | |
class BlocProvider<T extends BlocBase> extends StatefulWidget { | |
const BlocProvider({ | |
super.key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RemoteDataSource(private val context: Context) { | |
fun api(): Api { | |
val mockFitInterceptor = provideMockFitInterceptor(context) | |
val okHttpClient = provideOkHttpClient(mockFitInterceptor) | |
val retrofit = provideRetrofit(okHttpClient) | |
return retrofit.create(Api::class.java) | |
} | |
private fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit = Retrofit.Builder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Api { | |
@Mock("picsum_list.json") | |
@GET("list") | |
fun getListOfPicsums( | |
@Query("page") page: Int, | |
@Query("limit") limit: Int | |
): Call<List<Picsum>> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "1016", | |
"author": "Andrew Ridley", | |
"width": 3844, | |
"height": 2563, | |
"url": "https://unsplash.com/photos/_h7aBovKia4", | |
"download_url": "https://picsum.photos/id/1018/3914/2935" | |
}, | |
{ |