Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy an image to clipboard in flutter

I searched in google for how to copy an image to clipboard in flutter but I did not find any useful information. I only found in flutter documentation this:

"ClipboardData class:

Data stored on the system clipboard.

The system clipboard can contain data of various media types. This data structure currently supports only plain text data, in the text property."

https://api.flutter.dev/flutter/services/ClipboardData-class.html

Is it impossible to copy an image to clipboard in flutter right now?

like image 258
ouzari Avatar asked Oct 25 '25 15:10

ouzari


2 Answers

I did not try and not sure if the answer is you looking for but you can give a try that first you can convert your image to Uint8List format with BASE64 decode and encode then copy it. for conversion you can check this. link

how-to-convert-base64-string-into-image-with-flutter

also check answers of this threat

how-to-send-image-through-post-using-json-in-flutter

like image 93
Bilal Şimşek Avatar answered Oct 27 '25 04:10

Bilal Şimşek


This package allows copying images to the clipboard:

https://github.com/superlistapp/super_native_extensions/tree/main/super_clipboard

    final item = DataWriterItem();
    item.add(Formats.png(imageData));
    await ClipboardWriter.instance.write([item]);

There's some other steps to follow to get it setup in their README, but I managed to get it working.

like image 38
Bill Schumacher Avatar answered Oct 27 '25 03:10

Bill Schumacher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!