Norman
Norman

Reputation: 3147

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

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?, ...)?

Upvotes: 3

Views: 1356

Answers (1)

Yogesh Parwani
Yogesh Parwani

Reputation: 161

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);
}

Upvotes: 1

Related Questions