Comments (6)
@kinex Thanks for quick release!
from flutter_file_dialog.
In your code sample you are making some encoding for the data. The issue is most probably related to your own code. Please reopen with a full code sample and OS version information if you still think the issue is related to this plugin.
from flutter_file_dialog.
I have the same issue on Android 13.
Extra content is added to the end of file.
This happens when
- choose existing file and overwrite it.
- new file content is shorter than existing file content.
Flutter:3.0.5
Flutter File Dialog:2.3.0
Here is my code.
As you can see, original file is valid json and there is no encoding.
//backup to cache dir.
final tempDirPath = await getTemporaryDirectory();
final backupFilePath = join(tempDirPath.path, 'backup.json');
await _repository.backup(backupFilePath);
//check backup is valid.
final json = File(backupFilePath).readAsStringSync();
jsonDecode(json); //this doesn't throw FormatException, so backup is valid.
//show dialog and save backup file to where user selected.
final fileDialogParams = SaveFileDialogParams(sourceFilePath: backupFilePath);
final savedFilePath = await FlutterFileDialog.saveFile(params: fileDialogParams); //savedFile become invalid json when above conditions are satisfied,
If you have any ideas, please let me know.
from flutter_file_dialog.
I found this on stackoverflow.
Maybe you have to call output.channel.truncate(0)
before you write to output.
from flutter_file_dialog.
I have created PR.
Please review and if acceptable, merge it.
Thanks.
from flutter_file_dialog.
@hygehyge Thanks for the fix!
from flutter_file_dialog.
Related Issues (20)
- Wrong return path on not choosing folder HOT 1
- Missing file with building for ios
- in ios cant load csv txt xls HOT 1
- build issue in flutter master HOT 1
- Saving file does not overwrite existing unless selected HOT 4
- Implemented get absolute path for Android using PickiT library HOT 1
- Fatal Exception: java.lang.IllegalStateException Reply already submitted HOT 4
- File dialog now image only? HOT 1
- [bug][invalid_file_extension] Set file extension filter when picking a document.
- Android: Only download or recent available as targets for save HOT 5
- Android: path is incomplete after saveFile HOT 4
- If file already exist then the newly saved file gets renamed after file extension HOT 1
- [Bug]: MissingPluginException (MissingPluginException(No implementation found for method saveFile on channel flutter_file_dialog)) HOT 1
- Support for Windows ?
- Saving file with overwrite makes file unreadable by android OS
- DirectoryLocation custom class HOT 1
- pub.dev release HOT 1
- save multiple File
- No implementation found for method saveFile on channel flutter_file_dialog HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_file_dialog.