Closed bradcroteau closed 3 years ago
You should read up on the original library's documentation.
If you want to use things like "require" or "import"s on local files, then you need to bundle it up, then use a microservice.
The jscontext is for simple JavaScript evaluations. It doesn't do any file management type stuff.
Using flutter_liquidcore code like the following returns errors: ReferenceError: require is not defined; or ReferenceError: import is not defined.
if (_jsContext == null) { _jsContext = new JSContext(); String code = """ const API = require('./local-api/index.js')(); API.login("${aEmail}", "${aPassword}").then((output) => { API.Stats("${userTag}", "${platform}").then((output) => { console.log(output); }).catch((err) => { console.log(err); }); }).catch((err) => { console.log(err); }); """;
Being a node.js environment and not being able to break my javascript out of that _jsContext bubble to reference other .js files seems important for the utility of flutter_liquidcore.