void PrintString(str) {
if (str.length > 0) {
print(str);
} else {
throw new Exception('String is empty');
}
}
void main() {
var s = '';
try {
PrintString(s);
} catch (e) {
print('Exception: $e');
}
print('End main');
}
/*
run:
Exception: Exception: String is empty
End main
*/