```private suspend inline fun <reified T> en...
# android
Copy code
private suspend inline fun <reified T> encodeParams(value: T): String {
    return withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
            /* 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 use
I would use
to not unnecessarily block the IO dispatcher for non IO operations.
Also not sure why You need the url encoder if you encode a base 64 string. 🤔
My min api level is 21, so I would have to add extra logic to use that
I’d then create a api level switch to not create unnecessary strings on newer phones.
or as you are on Android there is also
Not sure about simplicity but if the encoding object is too large, then that might be a performance issue, as that would load the entire object into memory once, maybe stream the protocol buffers encoding to avoid loading the entire object.