Dart Exception Handling | How to handle Exceptions in Dart. Dart Tutorial for Flutter #7.1

preview_player
Показать описание

Dart beginners tutorials. Learn how to handle Exceptions in Dart using TRY, CATCH, ON and FINALLY Clause and Blocks. Also explore various common exceptions such as FormatException, IntegerDivisionByZeroException, IOException, DeferredLoadException, Timeout and IsolateSpawnException. These are all the runtime errors which can be handled easily.

.
Please donate and support my work
(If you think my free tutorials are better than paid ones :)

Free Programming courses:

Free Flutter course:

Free Android courses:

More free programming courses:

Check out my website:

Let's get in touch! [Sriyank Siddhartha]

---- Thank you for your love and support ----
Рекомендации по теме
Комментарии
Автор

Love these tutorials. Short and straight to the point with concise, clear examples. Well done. I have learned a lot. Terrific. Thank you.

davestr
Автор

I've learnt a lot so far from this Dart series! Really really thanks a lot! Very clear and solid teaching!

raymkfc
Автор

In 3m 52sec
Great Tip
Whenever we know that Exception Name that time we have to use "on" keyword

In 5m 16sec
Thanks for Mentioning Comments as Notes

karthickrajalearn
Автор

Hats off, your a born teacher (lecturer), Thanks for these lessons

ErangadeSaramEra
Автор

Hats off man! Absolutely well presented! The content just flows. Your ability to compress key concepts so well and clearly is just amazing! Thanks for this work.

andrewmukelabai
Автор

Wow great,
The way he will explain everyone can easily know how to fix all problems by exception

yashchandratray
Автор

For all the peeps who are facing error in dartpad

The issue here is that dart2js, which DartPad is based on, does not throw an (which should really be named DivisionByZeroError, but alas, isn't) when you do integer division by zero. It throws, but it's using UnsupportedError instead, which is otherwise a good choice for such an error.
Dart2js is not wrong. Neither the language specification, nor the library documentation for num.~/ says that it should throw that particular error type. Still, it's inconsistent with the other compilers, so we may want to make it consisent.

or simply try replacing the error recieved with with the error found i.e

void main(){

try {

int result = 12 ~/ 0;
print (result);

} on UnsupportedError {

print("hogaya solve");

}finally{

print("cool");

}
}

vighneshsharma
Автор

I really like your way of explaining: structured, complete, clear and usable. Hope you will be making more Flutter vids in the future. Thanks.

leonvanrijswijk
Автор

Perfect ehhehe, well-done dear, your huge efforts make this easy.

PrimaClicks
Автор

as usual very informative! you deserve my like and subscribe more power!

Nosreme_MCGG
Автор

you're tutorials are awesome. keep it up

abraramirhussain
Автор

What if I'll return while in catch ( when using functions), will the finally still run?

Meeshalkumar
Автор

void main()
{

try
{
int x =12 ~/ 0;
print("the result is $x");

} on
{
print("cannot devide by zero");
}
}


// gives me this type of error


Uncaught exception:
Unsupported operation: Result of truncating division is Infinity: 12 ~/ 0




its mean exception is not handled by the on clause?

dipendrasaini
Автор

what is live example of stack strace..

apnatuitioncoding
Автор

sir, your code file link does not work.
please help sir

amianand
Автор

Its really a great effort....! Thanks a lot!
Meanwhile when i tried following code,
//exception handling using by clause
void main(){
try {
int i= 12 ~/ 0;
print (i);
} on {
print ("number can not be divided by zero");
}
}
It throws this error "Error: Unsupported operation: Result of truncating division is Infinity: 12 ~/ 0". Can you please explain?

ranjitjohnbgl
Автор

Your code is not working in dartpad, Atom and vs code also.
Kindly try helping us Smartherd people. Please

kamalams
Автор

hi
how many videos are there for dart tutorial?
and when you are going to start flutter tutorial?
thanks a lot

SeraphimTech_io
Автор

is now deprecated, what should I use instead?

Nicosfrs
Автор

dude, you should consider updating videos, there are some new stuffs in dart

armagan_gok
join shbcf.ru