Created
March 22, 2023 15:46
-
-
Save daniel-v/69778ac766575b42884f231583549c04 to your computer and use it in GitHub Desktop.
requireJS Flutter web error Error: Mismatched anonymous define() module: function() { return CanvasKitInit; }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:js' as js; | |
import 'dart:js_util'; | |
import 'package:flutter/material.dart'; | |
void main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
runApp(const RequireRepro()); | |
} | |
class RequireRepro extends StatefulWidget { | |
const RequireRepro({Key? key}) : super(key: key); | |
@override | |
State<RequireRepro> createState() => _RequireReproState(); | |
} | |
class _RequireReproState extends State<RequireRepro> { | |
@override | |
void initState() { | |
super.initState(); | |
js.context.callMethod('require', [ | |
js.JsArray.from(['https://player.vimeo.com/api/player.js']), | |
js.allowInterop((player) { | |
js.context['console'].callMethod('dir', [player]); | |
}), | |
js.allowInterop((err) { | |
js.context['console'].callMethod('dir', [err]); | |
}), | |
]); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return const Placeholder(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment