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
It would be helpful if something like this was possible:
dependency_overrides:
"dart:io": universal_io
This would enable use packages like universal_io and universal_html without forking dependencies just to replace imports.
Proposed details:
The dependency override would be ignored if the target already supports dart:L.
The effect would be equal to replacing imports of dart:L with package:P/L.dart.
Behavior of configured imports would not be affected. Condition in if (dart.library.io) 'library.dart' would false in Dart2js even if dart:io was supplied with a dependency override.
Reacted by Stargator, Seb, Serge Shkurko, Amr Abdelwahab, Cédric Belin, Mitchell Tannenbaum, Maksim Lin and Tim
changed the title [-]Support dependency overrides for dart:io and dart:html[/-][+]Allow Pubspec.yaml to supply missing SDK libraries (dart:io, dart:html, etc.)[/+]on Jun 13, 2019
This feature could provide at least temporary help to Flutter web team, which seems to be thinking about cross-platform issues such as missing dart:io (#35969) and dart:developer (#36649). Angular would get server-side rendering in Dart VM (#225).
The proposal could be simplified by using prefix "__" for supplying SDK libraries ("__io", "__html", etc.). This feature would be just a preprocessor in the Dart frontend. In pseudo code:
when the preprocessor sees "import/export dart:L":
if target SDK doesn't have library "dart:L" and Pub has added "__L:file://path" in ".packages" file:
replace "dart:L" with "package:__L/L.dart"
With "__libraryName" convention, Pub doesn't need changes. Pub already generates ".packages" file when pubspec.yaml is:
dependency_overrides:
# This supplies dart:io to Dart2js__io:
git: "https://github.com/some/repository"# Package name must be "__io"
You wouldn't be able to use hosted packages (Pub would throw "package names must be equal"), but it can be fixed separately from this feature.
Activity
devoncarew commentedon Jun 11, 2019
I'm not sure where to best file this feature request - tentatively assigning to
area-library.[-]Support dependency overrides for dart:io and dart:html[/-][+]Allow Pubspec.yaml to supply missing SDK libraries (dart:io, dart:html, etc.)[/+]terrier989 commentedon Jun 13, 2019
This feature could provide at least temporary help to Flutter web team, which seems to be thinking about cross-platform issues such as missing dart:io (#35969) and dart:developer (#36649). Angular would get server-side rendering in Dart VM (#225).
The proposal could be simplified by using prefix "__" for supplying SDK libraries ("__io", "__html", etc.). This feature would be just a preprocessor in the Dart frontend. In pseudo code:
With "__libraryName" convention, Pub doesn't need changes. Pub already generates ".packages" file when pubspec.yaml is:
You wouldn't be able to use hosted packages (Pub would throw "package names must be equal"), but it can be fixed separately from this feature.