try except flutter
try {
print(x);
} on Exception catch (_) {
print('never reached');
}
try except flutter
try {
print(x);
} on Exception catch (_) {
print('never reached');
}
http exception flutter
// models/http_exception.dart
class HttpException implements Exception {
final String message;
HttpException(this.message);
@override
String toString() {
return message;
}
}
// in some other file
if (json.decode(response.body)['error'] != null) {
throw HttpException(json.decode(response.body)['error']['message']);
}
// in ui file
try{
} on HttpException catch(error) {
} catch (error) {
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us