How to use switch case with throw in Dart

1 Answer

0 votes
main() {
    var n = 0;
    switch (n) {
        case 0:
            throw IntegerDivisionByZeroException();
        default:
            print("default");
    }
}





/*
run:

Unhandled exception:
IntegerDivisionByZeroException

*/

 



answered Oct 21, 2022 by avibootz

Related questions

3 answers 337 views
337 views asked Oct 21, 2022 by avibootz
1 answer 236 views
236 views asked Oct 8, 2022 by avibootz
2 answers 277 views
277 views asked Oct 21, 2022 by avibootz
1 answer 211 views
1 answer 293 views
1 answer 224 views
2 answers 313 views
...