flutter_js
flutter_js copied to clipboard
Enable capturing of console.log output
Currently, all console.log
calls are relayed to the Dart print
function.
Most of the time this is fine, but there are some use cases where we need to do something with console.log
output.
temporary solution, works on flutter_js: 0.8.0
final runtime = getJavascriptRuntime();
dynamic logFn(dynamic args) {
// do what you want
}
// register channel callback
final channelCallbacks = JavascriptRuntime.channelFunctionsRegistered[runtime.getEngineInstanceId()];
channelCallbacks!["ConsoleLog"] = logFn;
Hope this helps.