How to create a custom exception and handle it in dart

后端 未结 3 1521
死守一世寂寞
死守一世寂寞 2021-02-11 13:51

I have written this code to test how custom exceptions are working in the dart.

I\'m not getting the desired output could someone explain to me how to handle it??

3条回答
  •  走了就别回头了
    2021-02-11 14:41

    You don't need an Exception class if you don't care about the type of Exception. Simply fire an exception like this:

    throw ("This is my first general exception");
    

提交回复
热议问题