Repository navigation
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.27Found to occur in 3.27Found to occur in 3.27found in release: 3.29Found to occur in 3.29Found to occur in 3.29has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Description
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Future<void> main() async {
runApp(const MyApp());
final Uint8List readFile =
await File(r'C:\Windows\System32\vcruntime140_1.dll').readAsBytes();
final String tryUtf8 = utf8.decode(readFile, allowMalformed: true);
print('UTF8 File as String: $tryUtf8');
final String charcodes = String.fromCharCodes(readFile);
print('Charcodes File as String: $tryUtf8');
await Clipboard.setData(ClipboardData(text: tryUtf8));
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}File content that we read with utf8
What is copied to clipboard
File content that we read with charcodes
What is copied to clipboard
Flutter doctor -v
PS C:\Users\swiftsoft\Desktop\test_project> flutter doctor -v
[√] Flutter (Channel stable, 3.27.3, on Microsoft Windows [Version 10.0.26100.2605], locale en-US)
• Flutter version 3.27.3 on channel stable at c:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c519ee916e (5 days ago), 2025-01-21 10:32:23 -0800
• Engine revision e672b006cb
• Dart version 3.6.1
• DevTools version 2.40.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
• Android SDK at C:\Users\swiftsoft\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.11.35327.3
• Windows 10 SDK version 10.0.22621.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
[√] IntelliJ IDEA Community Edition (version 2024.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.2.4
• Flutter plugin version 83.0.4
• Dart plugin version 243.23177
[√] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26100.2605]
• Edge (webReacted by Damy Wise
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.27Found to occur in 3.27Found to occur in 3.27found in release: 3.29Found to occur in 3.29Found to occur in 3.29has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Activity
danagbemava-nc commentedon Jan 28, 2025
Hi @krll-kov, curious, does this still occur if you read the string directly without reading from a file first? Assuming you just copy the output from the console and try to set that in the clipboard, does it still cut off?
krll-kov commentedon Jan 28, 2025
You can not read file as sting since it has malformed characters(for utf8 decoder), as for copy, you can copy it from console/notepad without any problems (manually, without flutter)
krll-kov commentedon Jan 28, 2025
And if you mean to create a var with manually copied string and try to copy it, then yes, it works
danagbemava-nc commentedon Jan 29, 2025
Yes, this is what I meant. Does this work as expected on the web? I want to confirm if this is specific to the windows platform or if it reproduces on other platforms as well. It would help if we could get a sample that doesn't rely on a windows specific file.
Thank you
krll-kov commentedon Jan 29, 2025
I do not know, I'm windows developer and have no idea of it's possible to read files on web, please,check that manually
danagbemava-nc commentedon Jan 30, 2025
I use the file_selector plugin to select some files that should contain some malformed characters and tested the sample on windows and macOS. On macOS, the clipboard appeared to retain all data but on windows, it got cut off after a certain point.
Steps to reproduce
cache.dill.track.dillfile from the build folder and wait for the logs to be printed (at this point, the clipboard should have the data) On windows, you can just select the dll file from the OPReproduces on stable & master
complete sample
Fix null terminator in input truncates clipboard (flutter#188652)
github-actions commentedon Aug 5, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.