KEMBAR78
Error Handling | PDF
0% found this document useful (0 votes)
15 views2 pages

Error Handling

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Error Handling

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Error handling in dart

An exception is an error that takes place inside the


program. When an exception occurs inside a program
the normal flow of the program is disrupted and it
terminates abnormally, displaying the error and
exception stack as output. So, an exception must be
taken care to prevent the application from
termination.
Example1:
void main() {
String geek = "GeeksForGeeks";
try{
var geek2 = geek ~/ 0;
print(geek2);
}
on FormatException{
print("Error!! \nCan't act as input is not an integer.");
}
}
Example2:
void main() {
String geek = "GeeksForGeeks";
try{
var geek2 = geek ~/ 0;
print(geek2); catch(e); print(e); }}

You might also like