Skip to content

Instantly share code, notes, and snippets.

@daniel-v
Created March 22, 2023 15:46
Show Gist options
  • Save daniel-v/69778ac766575b42884f231583549c04 to your computer and use it in GitHub Desktop.
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; }
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