How can I get android drawables in flutter

3,210

You may be able to convert your Drawables into a Bitmap and then convert the Bitmap into a base64 string and send it over the platform channel and convert the image back using the Image.memory constructor in Flutter. I'm not sure about the limitations on string size through the platform channels, but it should work as long as your images aren't huge.

Here are the answers I referenced: https://stackoverflow.com/a/9224180/8338783 and https://stackoverflow.com/a/46146008/8338783

Share:
3,210
Toni Joe
Author by

Toni Joe

Updated on December 05, 2022

Comments

  • Toni Joe
    Toni Joe 13 minutes

    Flutters platform channel supports types like null, int, double, string, list, and map. But how can one get platform specific types like drawables?

  • Toni Joe
    Toni Joe over 4 years
    Thanks Spencer. This seems to work. I'll give it a try.