0

In my Flutter app (for Android an iOS), I want to clear either all the clipboard entries or at least the last text I copied to the clipboard (so the last entry). For the moment, I'm only focusing on the Android part.

I took a look on the Clipboard documentation, but I can't find any method to clear any entry.

I also tried to clear the clipboard in Kotlin, as explained here, but it has no effect on my Samsung Galaxy M51 (API 31).

Is it then possible to clear anything in the clipboard on Android, and if yes, how?

Thanks.

matteoh
  • 2,810
  • 2
  • 29
  • 54

1 Answers1

0

api 28

val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
clipboard.clearPrimaryClip()
  • Thanks, but as I said above (check the second link), I already tried that and it has no effect whatsoever on my device... – matteoh Mar 16 '23 at 11:34
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 21 '23 at 14:03