Dart Exceptions: Catch Clause

"Hello World, I'm Vinit Mepani, a coding virtuoso driven by passion, fueled by curiosity, and always poised to conquer challenges. Picture me as a digital explorer, navigating through the vast realms of code, forever in pursuit of innovation.
In the enchanting kingdom of algorithms and syntax, I wield my keyboard as a magical wand, casting spells of logic and crafting solutions to digital enigmas. With each line of code, I embark on an odyssey of learning, embracing the ever-evolving landscape of technology.
Eager to decode the secrets of the programming universe, I see challenges not as obstacles but as thrilling quests, opportunities to push boundaries and uncover new dimensions in the realm of possibilities.
In this symphony of zeros and ones, I am Vinit Mepani, a coder by passion, an adventurer in the digital wilderness, and a seeker of knowledge in the enchanting world of code. Join me on this quest, and let's create digital wonders together!"
In earlier we have seen that Exception Handling using try and on clause where we know that which types of the error can occurs .
But in many case we do not know which types of Exception can occur our program, at that time we use Catch Clause.
We can pass one or two parameter in catch (). In this first one is the exception object which was thrown and second one is StackTrack object.
void main()
{
try{
int x= 5 ~/ 0;
print("The x valuse is $x");
}
catch(e , s)
{
print("Excepation : $e");
print(s);
}
}

Here, we have pass two parameter in on catch which is " e " and " s " , where " e " print exception and " s " print StackTrack, we can see in output like #0 ,#1, #2, #3




