Add ImmutableBuffer.fromFilePath#36623
Conversation
|
The reason this takes a file path instead of a File object is that we can sidestep the issue of users providing File implementations instead of a dart:io file. Providing the path as a string makes it obvious this uses the real file system. Having said that, it sort of kicks the can down the road to the framework to handle non dart:io Files. I don't think we have a way to detect that in Dart code, we'd need a native method that checked the Dart handle or similar. Maybe this should accept a Dart file so that we can check that and throw. |
|
@dnfield pointed out we can check the file runtime type. That makes it work |
|
auto label is removed for flutter/engine, pr: 36623, due to - The status or check suite Linux Unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Fixes flutter/flutter#112958
Loads the file bytes in a background worker, allowing very large files to be loaded without causing visible UI jank. Works around issues where dart:io struggles to load bytes on certain platforms above a given size