-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] remove implicit casts and implicit dynamic #27882
Conversation
| /// keys are `dynamic` because when JSON is deserialized from method channels | ||
| /// it arrives as `Map<dynamic, dynamic>`. | ||
| // TODO(yjbanov): use Json typedef when type aliases are shipped | ||
| extension JsonExtensions on Map<dynamic, dynamic> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it generating same js code under O4 optimization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an overall increase of 0.03% (or 286 bytes) in code size for flutter_gallery when I compare flutter build web --release vs flutter --local-engine=host_debug_unopt build web --release with this PR. Some of these do become runtime casts (maybe something we can ask the Darat team to optimize for O4), but nearly all of these are not in the rendering pipeline. Most are I/O and platform messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. We should try that pragma on the framework side for the most expensive as casts.
5da7ce3 to
6b54c26
Compare
|
The luci failure looks like a flake. Going to merge to kick the bots, but happy to revert is this causes trouble. |
| } | ||
| if (EngineSemanticsOwner.instance.receiveGlobalEvent(event)) { | ||
| return handler(event); | ||
| return handler(event) as html.EventListener?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there’s something wrong here.
loggedHandler *is* an event listener, it doesn’t return an event listener. And the same goes for handler. I reviewed the PR that introduced this mistake but I completely missed it 😔
I’ll fix it tomorrow morning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I guess this lint is useful after all :)
Fix implicit casts and implicit dynamics, and update
analysis_options.yaml.