-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed assertion: line 146 pos 14: 'errorCallback is dynamic Function(Object)': is not true. #22673
Comments
Please add the output of |
still not able. cause error, exception. import 'dart:async';
import 'package:portal/library/network.dart';
import 'package:portal/model/user_auth.dart';
abstract class LoginContract {
void onLoginSuccess(UserAuth user);
void onLoginError(String error);
}
class LoginPresenter {
LoginContract _view;
LoginPresenter(this._view);
Network _net = new Network();
static final BASE_URL = 'http://192.168.0.16/portal';
static final URL_LOGIN = BASE_URL + '/logged';
static final API_KEY = 'apgportal';
Future<UserAuth> login(String username, String password) {
return _net.post(URL_LOGIN, body : {
'token' : API_KEY,
'username' : username,
'password' : password
}).then((dynamic r) {
if(r["error"]) {
throw new Exception(r['error_msg']);
}
return new UserAuth.map(r["user"]);
});
}
doLogin(String username, String password) {
login(username, password).then((UserAuth user) {
_view.onLoginSuccess(user);
}).catchError((Exception error) => **_view.onLoginError(error.toString()));**
}
}
|
Can you please try with |
Getting the exact same issue. There seems to be something wrong with the catchError() method.
using the following code:
|
@p0wnd have you solved it? |
Try |
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! |
I am also experiencing this issue. Even on release builds which causes issues to random users. I hope there will be a solution soon. |
@NEmory this issue is closed. If you're seeing this it's probably another cause. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
getting error when we through Exception from post call :
The text was updated successfully, but these errors were encountered: