Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DartPad: How to get more information if the console only prints 'Script Error'?

Tags:

flutter

dart

For example: If I run this App in DartPad the console only says Script Error. How can I get more information (What is the exact error? Where is it located?, ...)?

like image 433
Norman Avatar asked Nov 22 '25 07:11

Norman


1 Answers

Try to wrap your code inside the try-catch block and then print the error on the console.

For example,

try {
   Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScreenTwo()));
} catch (e) {
   print(e);
}
like image 184
Yogesh Parwani Avatar answered Nov 24 '25 22:11

Yogesh Parwani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!