zt
01/14/2023, 5:56 AMprivate suspend inline fun <reified T> encodeParams(value: T): String {
return withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
URLEncoder.encode(
/* s = */ ProtoBuf.encodeToByteArray(value).encodeBase64(),
/* enc = */ Charsets.UTF_8.name
)
}
}
Could I improve this code any further? I wasn't sure if there was something simpler i could useChrimaeon
01/14/2023, 2:24 PMDispatchers.Default
to not unnecessarily block the IO dispatcher for non IO operations.Chrimaeon
01/14/2023, 2:26 PMChrimaeon
01/14/2023, 2:39 PMzt
01/14/2023, 4:55 PMChrimaeon
01/14/2023, 4:59 PMChrimaeon
01/14/2023, 5:01 PMandroid.util.Base64
Abhishek Sharma
01/16/2023, 1:17 PM