Avoid relying on unevaluated constants (dart defines) in the web engine #115853
Labels
c: proposal
A detailed proposal for a change to Flutter
engine
flutter/engine repository. See also e: labels.
P2
Important issues not at the top of the work list
platform-web
Web applications specifically
team-web
Owned by Web platform team
triaged-web
Triaged by Web platform team
We are in the middle of switching over to using pre-built platform dill files when invoking dart2js, see #99161. However, it appears that dart2js does not support unevaluated constants in the platform dill file. This means that the value of any dart defines that we use in the engine must be decided at the time that we build the platform kernels.
Here is my suggested plan of action on how to achieve this:
For the dart defines that decide which renderer we use, we will build separate sets of platform dills for each renderer variation and consume the corresponding dill during the app compilation process. We are already producing the renderer-specific files from the engine, and there are some tentative changes to adopt those new platform dills when invoking dart2js: Platform binaries reland #115502
All other dart defines that we use should be specifiable via the
FlutterConfiguration
object. Most of them already are, but there are a few that aren't, and we should convert those to have a corresponding flag in theFlutterConfiguration
object.In order to continue supporting use-cases where these are specified via dart defines, modify the dart wrapper that the flutter tool creates for the application to take the dart defines and pass them in via the dart configuration. Since the dart wrapper is compiled as part of the application compile process (and not part of the platform dill build) it will respect the dart defines that are passed in.
After this has changed, we can remove the code that reads the other dart defines in the engine and rely entirely on the flutter configuration for this.
The text was updated successfully, but these errors were encountered: