Skip to content

Use dart::bin::SetupDartIo to setup dart:io#176714

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
mraleph:reduce-duplication-in-embedder
Mar 4, 2026
Merged

Use dart::bin::SetupDartIo to setup dart:io#176714
auto-submit[bot] merged 2 commits into
flutter:masterfrom
mraleph:reduce-duplication-in-embedder

Conversation

@mraleph

@mraleph mraleph commented Oct 8, 2025

Copy link
Copy Markdown
Member

WIP

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Oct 8, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the dart:io setup to use the centralized dart::bin::SetupDartIoLibrary function, which is a good simplification. I've found one issue regarding an unused parameter that seems important for network security. Please see my detailed comment.

Comment thread engine/src/flutter/lib/io/dart_io.cc
@mraleph mraleph marked this pull request as draft October 8, 2025 13:21
@flutter-dashboard

Copy link
Copy Markdown

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Piinks

Piinks commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Greetings from stale PR triage! 👋
Is this change still on your radar?

@mraleph mraleph force-pushed the reduce-duplication-in-embedder branch 5 times, most recently from 1ef8cdd to aafeab2 Compare December 16, 2025 13:15
@mraleph mraleph force-pushed the reduce-duplication-in-embedder branch from aafeab2 to 978015d Compare March 3, 2026 10:31
@mraleph mraleph force-pushed the reduce-duplication-in-embedder branch from 978015d to 174de9e Compare March 3, 2026 20:37
@mraleph mraleph requested a review from mkustermann March 4, 2026 07:38
@mraleph mraleph marked this pull request as ready for review March 4, 2026 07:38

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the dart:io initialization to use the centralized dart::bin::SetupDartIoLibrary function. This simplifies the engine code by removing manual setup of native resolvers, hooks, and other properties, delegating this responsibility to the Dart SDK. The changes look good and improve code maintainability. I've found one minor issue regarding an unused parameter after the refactoring.

Comment on lines 18 to +20
void DartIO::InitForIsolate(bool may_insecurely_connect_to_all_domains,
const std::string& domain_network_policy) {
// TODO(https://dartbug.com/61694): move this code into dart_io_api.h
Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io"));
Dart_Handle result = Dart_SetNativeResolver(io_lib, dart::bin::LookupIONative,
dart::bin::LookupIONativeSymbol);
FML_CHECK(!CheckAndHandleError(result));
result = Dart_SetFfiNativeResolver(io_lib, dart::bin::LookupIOFfiNative);
FML_CHECK(!CheckAndHandleError(result));

const std::string& domain_network_policy,
const std::string& script_uri) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The domain_network_policy parameter is unused within this function following the refactoring. It should be removed to keep the API clean and avoid confusion.

This change will require corresponding updates to:

  • The function declaration in engine/src/flutter/lib/io/dart_io.h.
  • The call site in engine/src/flutter/runtime/dart_isolate.cc.
void DartIO::InitForIsolate(bool may_insecurely_connect_to_all_domains,
                            const std::string& script_uri) {
References
  1. The repository style guide (line 43) mandates following the Google C++ Style Guide, which recommends removing unused function parameters. (link)

@mraleph mraleph added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Mar 4, 2026
Merged via the queue into flutter:master with commit eb0b756 Mar 4, 2026
185 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Mar 5, 2026
Roll Flutter from 46fb7210422d to d3dd7744e81f (33 revisions)

flutter/flutter@46fb721...d3dd774

2026-03-04 15619084+vashworth@users.noreply.github.com Show warning when plugins do not support SwiftPM (flutter/flutter#182506)
2026-03-04 15619084+vashworth@users.noreply.github.com Give guided message when project is not compatible with SwiftPM (flutter/flutter#182394)
2026-03-04 danny@tuppeny.com Pass --web-define through to web runner when using --machine mode (flutter/flutter#183228)
2026-03-04 104147021+MohammedTarigg@users.noreply.github.com Improve SwiftPM minimum platform mismatch diagnostics (flutter/flutter#182375)
2026-03-04 vegorov@google.com Use dart::bin::SetupDartIo to setup dart:io (flutter/flutter#176714)
2026-03-04 engine-flutter-autoroll@skia.org Roll Skia from 3197848b14ad to ada0b7628c79 (5 revisions) (flutter/flutter#183221)
2026-03-04 engine-flutter-autoroll@skia.org Roll Skia from fe9e9f22c531 to 3197848b14ad (15 revisions) (flutter/flutter#183198)
2026-03-04 34465683+rkishan516@users.noreply.github.com refactor: remove material in reorderable_list_test, scroll_notification_test, scroll_physics_test, shortcuts_test, sliver_floating_header_test, snapshot_widget_test (flutter/flutter#182698)
2026-03-04 34465683+rkishan516@users.noreply.github.com refactor: remove material in pop_scope_test, route_notification_message_test, two_dimensional_utils, two_dimensional_viewport_test (flutter/flutter#182699)
2026-03-04 737941+loic-sharma@users.noreply.github.com Add dev/benchmarks/README.md (flutter/flutter#182976)
2026-03-03 jason-simmons@users.noreply.github.com Roll RapidJSON to a branch based on the current upstream head (flutter/flutter#183048)
2026-03-03 flar@google.com [Impeller] Update comments to reflect new info about 2-pass rendering (flutter/flutter#183050)
2026-03-03 47866232+chunhtai@users.noreply.github.com Add vmservices for accessibilityEvaluation (flutter/flutter#182791)
2026-03-03 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 0dCDM2oORHwDf_pyb... to JJw5EJ87vLGqFVl4h... (flutter/flutter#183177)
2026-03-03 lukas.klingsbo@gmail.com Support mixed color spaces in `Color.lerp` (flutter/flutter#182934)
2026-03-03 36861262+QuncCccccc@users.noreply.github.com Add warning when there is a widget with color between `Material` and `ListTile` (flutter/flutter#181402)
2026-03-03 41930132+hellohuanlin@users.noreply.github.com [ios]uitest for admob banner in scrollable list gesture issue (flutter/flutter#183128)
2026-03-03 engine-flutter-autoroll@skia.org Roll Packages from faa4e22 to 9083bc9 (4 revisions) (flutter/flutter#183164)
2026-03-03 15619084+vashworth@users.noreply.github.com Build App and native asset frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183136)
2026-03-03 engine-flutter-autoroll@skia.org Roll Skia from f886711f180d to fe9e9f22c531 (4 revisions) (flutter/flutter#183155)
2026-03-03 engine-flutter-autoroll@skia.org Roll Dart SDK from e86dbe9aa742 to c597ef90d2dc (2 revisions) (flutter/flutter#183147)
2026-03-03 codefu@google.com fix: bump matcher (flutter/flutter#183167)
2026-03-02 58529443+srujzs@users.noreply.github.com Use isA to test for exceptions (flutter/flutter#183129)
2026-03-02 dpxhfxywang@163.com [two_dimensional_scrollables] Fix tableview janks when first row/column pinned (flutter/flutter#180563)
2026-03-02 victorsanniay@gmail.com Add await to callsites of BasicMessageChannel.send (flutter/flutter#182868)
2026-03-02 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#183133)
2026-03-02 robert.ancell@canonical.com Improve FFI code for windowing (flutter/flutter#183098)
2026-03-02 kevinjchisholm@google.com [workflow] Update the changelog merge action to fetch the stable branch (flutter/flutter#183132)
2026-03-02 engine-flutter-autoroll@skia.org Roll Skia from e180358b7a7a to f886711f180d (2 revisions) (flutter/flutter#183130)
2026-03-02 jacksongardner@google.com Merge changelog from 3.41.3. (flutter/flutter#183131)
2026-03-02 50985133+SpiralMomentum@users.noreply.github.com Make TextDecoration final and unify maskValue across platforms (flutter/flutter#183070)
2026-03-02 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#182640)
2026-03-02 15619084+vashworth@users.noreply.github.com Enable SwiftPM by default on master and beta (flutter/flutter#182923)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
okorohelijah pushed a commit to okorohelijah/packages that referenced this pull request Mar 26, 2026
…r#11182)

Roll Flutter from 46fb7210422d to d3dd7744e81f (33 revisions)

flutter/flutter@46fb721...d3dd774

2026-03-04 15619084+vashworth@users.noreply.github.com Show warning when plugins do not support SwiftPM (flutter/flutter#182506)
2026-03-04 15619084+vashworth@users.noreply.github.com Give guided message when project is not compatible with SwiftPM (flutter/flutter#182394)
2026-03-04 danny@tuppeny.com Pass --web-define through to web runner when using --machine mode (flutter/flutter#183228)
2026-03-04 104147021+MohammedTarigg@users.noreply.github.com Improve SwiftPM minimum platform mismatch diagnostics (flutter/flutter#182375)
2026-03-04 vegorov@google.com Use dart::bin::SetupDartIo to setup dart:io (flutter/flutter#176714)
2026-03-04 engine-flutter-autoroll@skia.org Roll Skia from 3197848b14ad to ada0b7628c79 (5 revisions) (flutter/flutter#183221)
2026-03-04 engine-flutter-autoroll@skia.org Roll Skia from fe9e9f22c531 to 3197848b14ad (15 revisions) (flutter/flutter#183198)
2026-03-04 34465683+rkishan516@users.noreply.github.com refactor: remove material in reorderable_list_test, scroll_notification_test, scroll_physics_test, shortcuts_test, sliver_floating_header_test, snapshot_widget_test (flutter/flutter#182698)
2026-03-04 34465683+rkishan516@users.noreply.github.com refactor: remove material in pop_scope_test, route_notification_message_test, two_dimensional_utils, two_dimensional_viewport_test (flutter/flutter#182699)
2026-03-04 737941+loic-sharma@users.noreply.github.com Add dev/benchmarks/README.md (flutter/flutter#182976)
2026-03-03 jason-simmons@users.noreply.github.com Roll RapidJSON to a branch based on the current upstream head (flutter/flutter#183048)
2026-03-03 flar@google.com [Impeller] Update comments to reflect new info about 2-pass rendering (flutter/flutter#183050)
2026-03-03 47866232+chunhtai@users.noreply.github.com Add vmservices for accessibilityEvaluation (flutter/flutter#182791)
2026-03-03 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 0dCDM2oORHwDf_pyb... to JJw5EJ87vLGqFVl4h... (flutter/flutter#183177)
2026-03-03 lukas.klingsbo@gmail.com Support mixed color spaces in `Color.lerp` (flutter/flutter#182934)
2026-03-03 36861262+QuncCccccc@users.noreply.github.com Add warning when there is a widget with color between `Material` and `ListTile` (flutter/flutter#181402)
2026-03-03 41930132+hellohuanlin@users.noreply.github.com [ios]uitest for admob banner in scrollable list gesture issue (flutter/flutter#183128)
2026-03-03 engine-flutter-autoroll@skia.org Roll Packages from faa4e22 to 9083bc9 (4 revisions) (flutter/flutter#183164)
2026-03-03 15619084+vashworth@users.noreply.github.com Build App and native asset frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183136)
2026-03-03 engine-flutter-autoroll@skia.org Roll Skia from f886711f180d to fe9e9f22c531 (4 revisions) (flutter/flutter#183155)
2026-03-03 engine-flutter-autoroll@skia.org Roll Dart SDK from e86dbe9aa742 to c597ef90d2dc (2 revisions) (flutter/flutter#183147)
2026-03-03 codefu@google.com fix: bump matcher (flutter/flutter#183167)
2026-03-02 58529443+srujzs@users.noreply.github.com Use isA to test for exceptions (flutter/flutter#183129)
2026-03-02 dpxhfxywang@163.com [two_dimensional_scrollables] Fix tableview janks when first row/column pinned (flutter/flutter#180563)
2026-03-02 victorsanniay@gmail.com Add await to callsites of BasicMessageChannel.send (flutter/flutter#182868)
2026-03-02 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#183133)
2026-03-02 robert.ancell@canonical.com Improve FFI code for windowing (flutter/flutter#183098)
2026-03-02 kevinjchisholm@google.com [workflow] Update the changelog merge action to fetch the stable branch (flutter/flutter#183132)
2026-03-02 engine-flutter-autoroll@skia.org Roll Skia from e180358b7a7a to f886711f180d (2 revisions) (flutter/flutter#183130)
2026-03-02 jacksongardner@google.com Merge changelog from 3.41.3. (flutter/flutter#183131)
2026-03-02 50985133+SpiralMomentum@users.noreply.github.com Make TextDecoration final and unify maskValue across platforms (flutter/flutter#183070)
2026-03-02 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#182640)
2026-03-02 15619084+vashworth@users.noreply.github.com Enable SwiftPM by default on master and beta (flutter/flutter#182923)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11182)

Roll Flutter from 46fb7210422d to d3dd7744e81f (33 revisions)

flutter/flutter@46fb721...d3dd774

2026-03-04 15619084+vashworth@users.noreply.github.com Show warning when plugins do not support SwiftPM (flutter/flutter#182506)
2026-03-04 15619084+vashworth@users.noreply.github.com Give guided message when project is not compatible with SwiftPM (flutter/flutter#182394)
2026-03-04 danny@tuppeny.com Pass --web-define through to web runner when using --machine mode (flutter/flutter#183228)
2026-03-04 104147021+MohammedTarigg@users.noreply.github.com Improve SwiftPM minimum platform mismatch diagnostics (flutter/flutter#182375)
2026-03-04 vegorov@google.com Use dart::bin::SetupDartIo to setup dart:io (flutter/flutter#176714)
2026-03-04 engine-flutter-autoroll@skia.org Roll Skia from 3197848b14ad to ada0b7628c79 (5 revisions) (flutter/flutter#183221)
2026-03-04 engine-flutter-autoroll@skia.org Roll Skia from fe9e9f22c531 to 3197848b14ad (15 revisions) (flutter/flutter#183198)
2026-03-04 34465683+rkishan516@users.noreply.github.com refactor: remove material in reorderable_list_test, scroll_notification_test, scroll_physics_test, shortcuts_test, sliver_floating_header_test, snapshot_widget_test (flutter/flutter#182698)
2026-03-04 34465683+rkishan516@users.noreply.github.com refactor: remove material in pop_scope_test, route_notification_message_test, two_dimensional_utils, two_dimensional_viewport_test (flutter/flutter#182699)
2026-03-04 737941+loic-sharma@users.noreply.github.com Add dev/benchmarks/README.md (flutter/flutter#182976)
2026-03-03 jason-simmons@users.noreply.github.com Roll RapidJSON to a branch based on the current upstream head (flutter/flutter#183048)
2026-03-03 flar@google.com [Impeller] Update comments to reflect new info about 2-pass rendering (flutter/flutter#183050)
2026-03-03 47866232+chunhtai@users.noreply.github.com Add vmservices for accessibilityEvaluation (flutter/flutter#182791)
2026-03-03 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 0dCDM2oORHwDf_pyb... to JJw5EJ87vLGqFVl4h... (flutter/flutter#183177)
2026-03-03 lukas.klingsbo@gmail.com Support mixed color spaces in `Color.lerp` (flutter/flutter#182934)
2026-03-03 36861262+QuncCccccc@users.noreply.github.com Add warning when there is a widget with color between `Material` and `ListTile` (flutter/flutter#181402)
2026-03-03 41930132+hellohuanlin@users.noreply.github.com [ios]uitest for admob banner in scrollable list gesture issue (flutter/flutter#183128)
2026-03-03 engine-flutter-autoroll@skia.org Roll Packages from faa4e22 to 9083bc9 (4 revisions) (flutter/flutter#183164)
2026-03-03 15619084+vashworth@users.noreply.github.com Build App and native asset frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183136)
2026-03-03 engine-flutter-autoroll@skia.org Roll Skia from f886711f180d to fe9e9f22c531 (4 revisions) (flutter/flutter#183155)
2026-03-03 engine-flutter-autoroll@skia.org Roll Dart SDK from e86dbe9aa742 to c597ef90d2dc (2 revisions) (flutter/flutter#183147)
2026-03-03 codefu@google.com fix: bump matcher (flutter/flutter#183167)
2026-03-02 58529443+srujzs@users.noreply.github.com Use isA to test for exceptions (flutter/flutter#183129)
2026-03-02 dpxhfxywang@163.com [two_dimensional_scrollables] Fix tableview janks when first row/column pinned (flutter/flutter#180563)
2026-03-02 victorsanniay@gmail.com Add await to callsites of BasicMessageChannel.send (flutter/flutter#182868)
2026-03-02 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#183133)
2026-03-02 robert.ancell@canonical.com Improve FFI code for windowing (flutter/flutter#183098)
2026-03-02 kevinjchisholm@google.com [workflow] Update the changelog merge action to fetch the stable branch (flutter/flutter#183132)
2026-03-02 engine-flutter-autoroll@skia.org Roll Skia from e180358b7a7a to f886711f180d (2 revisions) (flutter/flutter#183130)
2026-03-02 jacksongardner@google.com Merge changelog from 3.41.3. (flutter/flutter#183131)
2026-03-02 50985133+SpiralMomentum@users.noreply.github.com Make TextDecoration final and unify maskValue across platforms (flutter/flutter#183070)
2026-03-02 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#182640)
2026-03-02 15619084+vashworth@users.noreply.github.com Enable SwiftPM by default on master and beta (flutter/flutter#182923)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants