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
{{ message }}
Repository navigation
Merge the web platform support with mainline Flutter. #34082
To date, the Flutter web platform support has been in its own fork. While you can now build an application for the web using Flutter (see here, doing so causes the flutter tool to pull a bunch of cached artifacts that are forked, rather than directly derived from, the mainline.
This can have numerous unforeseen consequences --- impacts to network use and disk space, and because it's a fork, bugs you expect to be fixed in the mainline for a given channel may still not be fixed in the fork.
Flutter for web remains experimental at least until this is resolved, and in all likelihood longer.
Hi, sorry to interrupt. I have two questions related to the new approach.
(1) I am wondering wether flutter run -d chrome will call webdev in the background or not? If it calls webdev, should I install or update the webdev program manually? OR can I remove webdev completely?
(2) What is the best practice to manage the project for both mobile and web support?
I am thinking of two ways.
One way is creating three projects, one for common, one for mobile and one for web. And both mobile and web projects import the common project.
Another way is only using one project and use some switch/if tests to determine which platform it's on and then execute the corresponding code. (btw I am not sure how to test the platform for web at present though. It seems TargetPlatform does not have a web value)
@sgon00 regarding how to test the platform for web, I can provide something.
Since http is a cross-platform library in dart, supporting both web environment and native app environment, we could dig into its source code to find out how this is done.
Looking at the source code, http lib defines a browser_client.dart for browser env, and io_client.dart for native app, and combine them by conditional import using dart.library.html variable. Using this technique, you could also detect web platform.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
kf6gpe commentedon Jun 7, 2019
/cc @jonahwilliams
jonahwilliams commentedon Jul 5, 2019
@gedw99 yes, this would involving having a project import
flutterand notflutter_weband using all of the existing flutter tooling.sgon00 commentedon Aug 20, 2019
Hi, sorry to interrupt. I have two questions related to the new approach.
(1) I am wondering wether
flutter run -d chromewill callwebdevin the background or not? If it callswebdev, should I install or update thewebdevprogram manually? OR can I removewebdevcompletely?(2) What is the best practice to manage the project for both mobile and web support?
I am thinking of two ways.
One way is creating three projects, one for common, one for mobile and one for web. And both mobile and web projects import the common project.
Another way is only using one project and use some
switch/iftests to determine which platform it's on and then execute the corresponding code. (btw I am not sure how to test the platform for web at present though. It seems TargetPlatform does not have a web value)Thanks a lot.
zTrix commentedon Aug 23, 2019
@sgon00 regarding how to test the platform for web, I can provide something.
Since http is a cross-platform library in dart, supporting both web environment and native app environment, we could dig into its source code to find out how this is done.
https://github.com/dart-lang/http/blob/master/lib/src/client.dart#L14
Looking at the source code, http lib defines a
browser_client.dartfor browser env, andio_client.dartfor native app, and combine them by conditional import usingdart.library.htmlvariable. Using this technique, you could also detect web platform.Some more info about conditional import: https://medium.com/@dvargahali/dart-2-conditional-imports-update-16147a776aa8
yjbanov commentedon Oct 1, 2019
This is done.
github-actions commentedon Aug 17, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.