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 327 views
327 views asked Oct 21, 2022 by avibootz
1 answer 232 views
232 views asked Oct 8, 2022 by avibootz
2 answers 265 views
265 views asked Oct 21, 2022 by avibootz
1 answer 203 views
1 answer 281 views
1 answer 212 views
2 answers 304 views
...