You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a file "1.bin". Windows/Android/Python program/C program all read it as having 381536 bytes. When I transfer 1.bin, it programs my esp8266 correctly.
The below methods in DART all print out 381136 bytes. This causes my esp8266 to behave incorrectly. I am not sure why it does not read the remaining 400 bytes consistently no matter what i do.
Example code:
var file = File(_filePath!);
var buffer = List.filled(400000, 0xFF);
print('BUFFER: $buffer');
var raf = file.openSync();
var counter = 0;
for (int i = 0; i < 400000; i += 4096) {
print('Reading from $i to ${i + 4096}');
counter += raf.readIntoSync(buffer, i, i+4096); // Read bytes into the buffer
print('BUFFER: $counter');
}
ok i figured it out. I was using a much older version of filepicker (5.2.6) from an example code in pubspec.yaml. I updated it to 8.0.3 and it works as intended. sorry for the trouble.
Given a file "1.bin". Windows/Android/Python program/C program all read it as having 381536 bytes. When I transfer 1.bin, it programs my esp8266 correctly.
The below methods in DART all print out 381136 bytes. This causes my esp8266 to behave incorrectly. I am not sure why it does not read the remaining 400 bytes consistently no matter what i do.
Example code:$i to $ {i + 4096}');
var file = File(_filePath!);
var buffer = List.filled(400000, 0xFF);
print('BUFFER: $buffer');
var raf = file.openSync();
var counter = 0;
for (int i = 0; i < 400000; i += 4096) {
print('Reading from
counter += raf.readIntoSync(buffer, i, i+4096); // Read bytes into the buffer
print('BUFFER: $counter');
}
or
Uint8List fileBytes = file.readAsBytesSync();
print(fileBytes.length);
or
Uint8List fileBytes = await file.readAsBytes();
print(fileBytes.length);
The text was updated successfully, but these errors were encountered: