Skip to content

Commit

Permalink
fix(core, web): fix an incompatibility with Flutter Beta that would o…
Browse files Browse the repository at this point in the history
…ccur when calling method on TrustedScriptURL (#12274)

* fix(core, web): fix an incompatibility with Flutter Beta that would occur when calling method on TrustedScriptURL

* analyze

* analyze
  • Loading branch information
Lyokone committed Feb 2, 2024
1 parent 8d944a2 commit c395da5
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -129,10 +129,15 @@ class FirebaseCoreWeb extends FirebasePlatform {
web.document.createElement('script') as web.HTMLScriptElement;
script.type = 'text/javascript';
script.crossOrigin = 'anonymous';
final stringUrl = trustedUrl != null
// Necessary for the JS interop to work correctly on Flutter Beta 3.19.
// ignore: unnecessary_cast
? (trustedUrl as JSObject).callMethod('toString'.toJS)
: src;
script.text = '''
window.ff_trigger_$windowVar = async (callback) => {
console.debug("Initializing Firebase $windowVar");
callback(await import("${trustedUrl != null ? trustedUrl.callMethod('toString'.toJS) : src}"));
callback(await import("$stringUrl"));
};
''';

Expand Down

0 comments on commit c395da5

Please sign in to comment.