Skip to content
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

Closed
ambariss7 opened this issue Oct 4, 2018 · 10 comments
Labels
waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@ambariss7
Copy link

ambariss7 commented Oct 4, 2018

getting error when we through Exception from post call :

E/flutter ( 8766): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter ( 8766): **'dart:async/future_impl.dart': Failed assertion: line 146 pos 14: 'errorCallback is dynamic Function(Object)': is not true.**
E/flutter ( 8766): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter ( 8766): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter ( 8766): #2      _FutureListener.handleError (dart:async/future_impl.dart:146:14)
E/flutter ( 8766): #3      Future._propagateToListeners.handleError (dart:async/future_impl.dart:654:47)
E/flutter ( 8766): #4      Future._propagateToListeners (dart:async/future_impl.dart:675:24)
E/flutter ( 8766): #5      Future._complete (dart:async/future_impl.dart:476:7)
E/flutter ( 8766): #6      _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 8766): #7      _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
E/flutter ( 8766): #8      _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:295:13)
E/flutter ( 8766): #9      _withClient (package:http/http.dart)
E/flutter ( 8766): <asynchronous suspension>
E/flutter ( 8766): #10     post (package:http/http.dart:70:3)
E/flutter ( 8766): #11     Network.post (package:portal/library/network.dart:27:12)
E/flutter ( 8766): #12     LoginPresenter.login (package:portal/controller/login_presenter.dart:30:17)
E/flutter ( 8766): #13     LoginPresenter.doLogin (package:portal/controller/login_presenter.dart:47:5)
E/flutter ( 8766): #14     _LoginPageState._submit (package:portal/view/login_page.dart:39:18)
E/flutter ( 8766): #15     _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:503:14)
E/flutter ( 8766): #16     _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:558:30)
E/flutter ( 8766): #17     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 8766): #18     TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter ( 8766): #19     TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
E/flutter ( 8766): #20     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter ( 8766): #21     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter ( 8766): #22     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter ( 8766): #23     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter ( 8766): #24     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter ( 8766): #25     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 8766): #26     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter ( 8766): #27     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter ( 8766): #28     _invoke1 (dart:ui/hooks.dart:142:13)
E/flutter ( 8766): #29     _dispatchPointerDataPacket (dart:ui/hooks.dart:99:5)
@zoechi
Copy link
Contributor

zoechi commented Oct 4, 2018

Please add the output of flutter doctor -v
and the code that causes this exception.

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 4, 2018
@ambariss7
Copy link
Author

ambariss7 commented Oct 4, 2018

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()));**

  }
}

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 4, 2018
@zoechi
Copy link
Contributor

zoechi commented Oct 4, 2018

Can you please try with { _view.on...} instead of =>

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 4, 2018
@ambariss7 ambariss7 reopened this Oct 5, 2018
@Yanpass
Copy link

Yanpass commented Oct 7, 2018

Getting the exact same issue. There seems to be something wrong with the catchError() method.

W/BiChannelGoogleApi( 6741): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@fe8b452
E/flutter ( 6741): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter ( 6741): 'dart:async/future_impl.dart': Failed assertion: line 146 pos 14: 'errorCallback is dynamic Function(Object)': is not true.
E/flutter ( 6741): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter ( 6741): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter ( 6741): #2      _FutureListener.handleError (dart:async/future_impl.dart:146:14)
E/flutter ( 6741): #3      Future._propagateToListeners.handleError (dart:async/future_impl.dart:654:47)
E/flutter ( 6741): #4      Future._propagateToListeners (dart:async/future_impl.dart:675:24)
E/flutter ( 6741): #5      Future._completeError (dart:async/future_impl.dart:494:5)
E/flutter ( 6741): #6      _SyncCompleter._completeError (dart:async/future_impl.dart:55:12)
E/flutter ( 6741): #7      _Completer.completeError (dart:async/future_impl.dart:27:5)
E/flutter ( 6741): #8      _AsyncAwaitCompleter.completeError (dart:async/runtime/libasync_patch.dart:40:18)
E/flutter ( 6741): #9      FirebaseAuth.signInWithEmailAndPassword (package:firebase_auth/firebase_auth.dart)
E/flutter ( 6741): <asynchronous suspension>
E/flutter ( 6741): #10     _LandingPageState._confirmPressed (package:ns_pv/routes/LandingPage.dart:111:29)
E/flutter ( 6741): #11     _LandingPageState.build.<anonymous closure> (package:ns_pv/routes/LandingPage.dart:58:21)
E/flutter ( 6741): #12     _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:503:14)
E/flutter ( 6741): #13     _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:558:30)
E/flutter ( 6741): #14     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 6741): #15     TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter ( 6741): #16     TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
E/flutter ( 6741): #17     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter ( 6741): #18     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter ( 6741): #19     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter ( 6741): #20     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter ( 6741): #21     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter ( 6741): #22     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 6741): #23     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter ( 6741): #24     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter ( 6741): #25     _invoke1 (dart:ui/hooks.dart:142:13)
E/flutter ( 6741): #26     _dispatchPointerDataPacket (dart:ui/hooks.dart:99:5)

using the following code:

 FirebaseAuth.instance.signInWithEmailAndPassword(email: _emailController.text, password: _passwordController.text).catchError((PlatformException e) {
        print(e.message);
      });

@ronaldG19
Copy link

@p0wnd have you solved it?

@zoechi
Copy link
Contributor

zoechi commented Oct 8, 2018

Try }).catchError((Object error) instead of more specific types like Exception or PlatformException

@zoechi
Copy link
Contributor

zoechi commented Nov 30, 2018

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!
Thanks for your contribution.

@zoechi zoechi closed this as completed Nov 30, 2018
@oliverbytes
Copy link

I am also experiencing this issue. Even on release builds which causes issues to random users. I hope there will be a solution soon.

@zoechi
Copy link
Contributor

zoechi commented Jan 2, 2019

@NEmory this issue is closed. If you're seeing this it's probably another cause.
Please create a new issue with properly filled issue template.

@github-actions
Copy link

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests

5 participants