when you want to load/read a json file on all platforms?
We have a mock server we use for offline testing/development and we currently add json as strings in a kotlin file but would be nice if we can change this to loading a specific json file when the mock server needs to respond instead of using the string
val
.
t
thedroiddiv
10/30/2025, 10:59 AM
You can use Res.readBytes() or Res.readUri()
It reads content at "composeResources/res-package/<path-you-provided>
d
dylan
10/30/2025, 12:09 PM
yeah I know that but is there also an easy solution for without having to depend on compose multiplatform.
j
Jiri Bruchanov
10/31/2025, 7:26 AM
Depends on what you mean by all platforms, you can always do what the target platform offers and use own expect/actual readers
This works easily on jvm/android/ios