Hi Everyone. Can anyone tell me how to use toast i...
# multiplatform
m
Hi Everyone. Can anyone tell me how to use toast in commonMain so that work for both IOS and Android?
m
One option is to define an
expect
function for it. On Android it requires access to a
Context
. I don't know what is needed on iOS. You won't have this available normally in common code, so that makes this option harder. The other option would be to define an interface and use DI to have the platform specific application pass in the correct implementation for that platform.
m
Thanks @Michael Krussel I'm going with the snackbar.
I am stuck at changing color of the snackbar at runtime