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
MouseEvent.offset: The dart:html version returns a Point with offsetX and offsetY. There's some checking to make sure offsetX is supported, but that's stale since modern browsers should support it: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX. If the Point class is heavily used in devtools, then maybe we should add it as a helper class in package:web. If not, using a record with offsetX and offsetY should probably suffice.
createObjectURL: The dart:html version checks for a webkitURL. This is no longer needed as it seems all browsers nowadays support URL: https://developer.mozilla.org/en-US/docs/Web/API/URL so it should be safe to use the package:web version => URL.createObjectURL.
html.window.onMessage: I think this needs _ElementEventStreamImpl to be added to the helpers in package:web. A workaround is using event listeners, but Streams are nicer. Sorry, was looking at the wrong code. I think this just needs the existing onMessage to be exposed on top of Window. I think you can just do EventStreamProviders.messageEvent.forTarget(window).
I think you'll need to downcast MouseEvent to DragEvent to get dataTransfer, which then has a dropEffect property.
You want to avoid importing dart:js here. The type you want is JSArray (I know the naming is unfortunate, but alas). To convert from a list to one, you need a List<JSAny>. This can be created by making content itself a JSString: [content.toJS].toJS should get you want you the JSArray you need.
I think this is similar to the other issues where this stream getter is not available (onLoadEnd). It does seems to exist on Element, so a hacky workaround until we publish a version with it is to just cast to Element and use onLoad (note that we don't check whether that cast is correct since they're both just some random JS objects in the type system's eyes).
lastModifiedData is deprecated in the browser. The right equivalent here is using lastModified to get the ms since epoch to construct a DateTime e.g. DateTime.fromMillisecondsSinceEpoch(droppedFile.lastModifiedDate, isUtc: true).
You'll need to downcast here to the Element type you want. I believe downcasting element to HTMLAnchorElement should resolve the rest. Using createElement and then downcasting is a downgrade from the nice dart:html constructors, and maybe we should have a createElementAs<HTMLAnchorElement>()-like helper somewhere.
Activity
devtools_app: migrate _analytics_web.dart to pkg:web
devtools_app: migrate _analytics_web.dart to pkg:web (#6607)
kenzieschmoll commentedon Oct 31, 2023
migrations for
devtools_appthat are not straightforward, or just need a little more attention to figure out:MouseEvent.offsetfor (var element in html.document.body!.querySelectorAll('.legacy-dart'))Url.createObjectUrlwindow.consolewindow.consolepackage:http#6712html.window.onMessage.map(...)- addressed by AddonMessagegetter toWindowEventGettersextension methods dart-lang/web#95kevmoo commentedon Oct 31, 2023
Console:
https://pub.dev/documentation/web/0.3.0/helpers/console.html
https://pub.dev/documentation/web/0.3.0/helpers/$ConsoleExtension.html
srujzs commentedon Nov 7, 2023
MouseEvent.offset: Thedart:htmlversion returns aPointwithoffsetXandoffsetY. There's some checking to make sureoffsetXis supported, but that's stale since modern browsers should support it: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX. If thePointclass is heavily used in devtools, then maybe we should add it as a helper class inpackage:web. If not, using a record withoffsetXandoffsetYshould probably suffice.createObjectURL: Thedart:htmlversion checks for awebkitURL. This is no longer needed as it seems all browsers nowadays supportURL: https://developer.mozilla.org/en-US/docs/Web/API/URL so it should be safe to use thepackage:webversion =>URL.createObjectURL.html.window.onMessage:I think this needsSorry, was looking at the wrong code. I think this just needs the existing_ElementEventStreamImplto be added to the helpers inpackage:web. A workaround is using event listeners, butStreams are nicer.onMessageto be exposed on top ofWindow. I think you can just doEventStreamProviders.messageEvent.forTarget(window).kenzieschmoll commentedon Nov 9, 2023
@srujzs
re:
MouseEvent, what about thedataTransferproperty?event.dataTransfer.dropEffect = 'move';re:


createObjectURL- more issues:re:
html.window.onMessageonMessagegetter toWindowEventGettersextension methods dart-lang/web#95srujzs commentedon Nov 10, 2023
I think you'll need to downcast
MouseEventtoDragEventto getdataTransfer, which then has adropEffectproperty.You want to avoid importing
dart:jshere. The type you want isJSArray(I know the naming is unfortunate, but alas). To convert from a list to one, you need aList<JSAny>. This can be created by makingcontentitself aJSString:[content.toJS].toJSshould get you want you theJSArrayyou need.kenzieschmoll commentedon Nov 10, 2023
Thanks @srujzs. Getting closer! A few more errors to go:
readeris aFileReaderobject, anddroppedFileis aFileobject:element.style.display = 'none'document.body!.append(element);element.click()srujzs commentedon Nov 10, 2023
Nice!
onLoadEnd). It does seems to exist onElement, so a hacky workaround until we publish a version with it is to just cast toElementand useonLoad(note that we don't check whether that cast is correct since they're both just some random JS objects in the type system's eyes).lastModifiedDatais deprecated in the browser. The right equivalent here is usinglastModifiedto get the ms since epoch to construct aDateTimee.g.DateTime.fromMillisecondsSinceEpoch(droppedFile.lastModifiedDate, isUtc: true).Elementtype you want. I believe downcastingelementtoHTMLAnchorElementshould resolve the rest. UsingcreateElementand then downcasting is a downgrade from the nicedart:htmlconstructors, and maybe we should have acreateElementAs<HTMLAnchorElement>()-like helper somewhere.kevmoo commentedon Nov 13, 2023
Closing this out as completed via #6626 - still waiting for dependencies to migrate so we can build w/ wasm
kenzieschmoll commentedon Nov 13, 2023
Everything has been migrated to package:web except for one file: https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/shared/config_specific/post_message/_post_message_web.dart#L5-L9. Removing this is blocked on a new version of
package:webgetting rolled into flutter.However, if we want to start experimenting with dart2wasm now, apply the changes from this patch and it should compile fine: https://github.com/flutter/devtools/compare/master...kenzieschmoll:dart2wasm-experiment?expand=1.
@kevmoo
kevmoo commentedon Nov 13, 2023
Reopening then. To stay on top of #6606 (comment)
4 remaining items
kevmoo commentedon Dec 13, 2023
Glad we're getting numbers on this. I think the only concrete thing blocking us is either migrating the inline
gtagsor moving tounified_analytics.Is the latter tracked anywhere?
kenzieschmoll commentedon Dec 13, 2023
migrating to unified_analytics is tracked here: #6242. This is something that @eliasyishak may be picking up in the short term.
[file_selector_web] migrate to pkg:web (flutter#5413)
[shared_preferences_web] migrate to pkg:web (flutter#5414)
[file_selector_web] migrate to pkg:web (flutter#5413)
[shared_preferences_web] migrate to pkg:web (flutter#5414)