I'm unable to get any error output from my Flutter web app. Printing to the console using
print('some text');
works fine, but no errors get printed. For example, throwing an exception
throw new Exception('testexception');
doesn't result in any output, neither in the browser console nor in IntelliJ. The log level settings in Chrome are set to [Info, Warnings, Errors].
I even tried implementing a custom error handler
void main(){
FlutterError.onError = (FlutterErrorDetails details) {
print('main.onError: details: ${details.toString()}');
};
runApp(new MyApp());
}
but no luck. Do I have to enable error outputs somewhere? I can't find any info about this in the documentation.
I tried running the app both using the Dart Dev Server (which is started when using Run from IntelliJ), as well as calling webdev serve and webdev serve --auto restart from the Terminal.
Flutter Web currently doesn't have a way to be debugged. Will generate a main.dart.js and you can debug it with Chrome console.
One cool trick to "debug" your Web App, is by showing a popup to your browser:
import 'dart:js' as js;
@override
void initState() {
super.initState();
js.context.callMethod("alert", <String>["Your debug message"]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With