flutter-plugins
flutter-plugins copied to clipboard
[pasteboard] write image failed
A clear and concise description of what the bug is.
Reproduce Steps
this is part of my code, it toggle Pasteboard.writeImage
OutlinedButton(
onPressed: () async {
final imagefile = File("/home/steiner/disk/windows-data/Download/私を染めるiの歌_109951167807493772.jpg");
final bytes = await imagefile.readAsBytes();
await Pasteboard.writeImage(bytes);
final imagebytes = await Pasteboard.image;
print(imagebytes?.length);
},
child: const Text("copy image to clipboard"),
)
whatever the image is, the result is always null
Expected behavior
A clear and concise description of what you expected to happen.
the result shouldn't be null
Version (please complete the following information):
- Flutter Version: 3.10.6
- OS: Linux 6.1.39-1-lts
- plugin: pasteboard 0.2.0
you can check the full code
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:pasteboard/pasteboard.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: "clipboard",
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(title: const Text("hello clipboard")),
body: buildBody(context),
);
}
Widget buildBody(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
OutlinedButton(
onPressed: () {
Pasteboard.writeText("fuck you");
},
child: const Text("copy text to clipboard"),
),
OutlinedButton(
onPressed: () async {
final imagefile = File("/home/steiner/disk/windows-data/Download/私を染めるiの歌_109951167807493772.jpg");
final bytes = await imagefile.readAsBytes();
await Pasteboard.writeImage(bytes);
final imagebytes = await Pasteboard.image;
print(imagebytes?.length);
},
child: const Text("copy image to clipboard"),
)
],
),
);
}
}