Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Add ImmutableBuffer.fromFilePath#36623

Merged
auto-submit[bot] merged 7 commits intoflutter:mainfrom
jonahwilliams:load_from_file
Oct 5, 2022
Merged

Add ImmutableBuffer.fromFilePath#36623
auto-submit[bot] merged 7 commits intoflutter:mainfrom
jonahwilliams:load_from_file

Conversation

@jonahwilliams
Copy link
Contributor

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

Jonah Williams added 3 commits October 5, 2022 11:51
@jonahwilliams
Copy link
Contributor Author

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.

Thoughts @dnfield @zanderso ?

@jonahwilliams
Copy link
Contributor Author

@dnfield pointed out we can check the file runtime type. That makes it work

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 5, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 5, 2022

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.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 5, 2022
@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 5, 2022
@auto-submit auto-submit bot merged commit 062edc4 into flutter:main Oct 5, 2022
@jonahwilliams jonahwilliams deleted the load_from_file branch October 5, 2022 22:19
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow constructing an Immutable from a File or from a List of byte chunks

2 participants