Package me.nikhilchaudhari.usefetch

Types

Result
Link copied to clipboard
sealed class Result

Result class represents the state value of your network response

Functions

useFetch
Link copied to clipboard
@Composable
fun useFetch(url: String, headers: Map<String, String?> = mapOf(), params: Map<String, String> = mapOf(), auth: Auth? = null, timeout: Double = DEFAULT_TIMEOUT): State<Result>

useFetch for GET network request This composable lets you to create a GET network request and returns the response as a State values. You receive your appropriate Result as State. The resultState has three states as mentioned in the return type. You can consume Result.Response.data to get the ResponseData object. The composable will be called again if any of the url, headers, params changes.

Properties

DEFAULT_DATA_HEADERS
Link copied to clipboard
val DEFAULT_DATA_HEADERS: Map<String, String>

Default data headers

DEFAULT_FORM_HEADERS
Link copied to clipboard
val DEFAULT_FORM_HEADERS: Map<String, String>

Default form headers

DEFAULT_HEADERS
Link copied to clipboard
val DEFAULT_HEADERS: Map<String, String>

Default headers

DEFAULT_JSON_HEADERS
Link copied to clipboard
val DEFAULT_JSON_HEADERS: Map<String, String>

Default JSON headers