Open
Description
I'm doing a migration to 'package:web' and 'dart:js_interop'. I'm currently using the context object from the 'dart:js' package to store functions in the window object reference. However, I've noticed that there's no direct way to access the context from the 'package:web'.
I need help with this migration. Below is the code snippet I need to migrate
void _connectJsToFlutter({VoidCallback? then}) {
js.context['$jsToDartConnectorFN$iframeViewType'] = (js.JsObject window) {
jsWindowObject = window;
for (final cb in widget.dartCallBacks) {
jsWindowObject[cb.name] = cb.callBack;
}
jsWindowObject[webOnClickInsideIframeCallback] = (onClickCallbackObject) {
_handleOnIframeClick(onClickCallbackObject as String);
};
webViewXController.connector = jsWindowObject;
then?.call();
};
}
Can you provide the correct usage of context and JsObject needed for the migration?