Skip to content

Error unexpected null value #23

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

Open
salehmalik121 opened this issue Jul 4, 2021 · 1 comment
Open

Error unexpected null value #23

salehmalik121 opened this issue Jul 4, 2021 · 1 comment

Comments

@salehmalik121
Copy link

when I use if statement to validate talking about this if statement:
movetoHome(BuildContext context) async { if (_formKey.currentState!.validate()) { setState(() { changebutton = true; }); await Future.delayed(Duration(seconds: 1)); await Navigator.pushNamed(context, Myroutes.homeRoute); setState(() { changebutton = false; }); } }

    1. If I run using f5 it takes me to breaking point in feedback.dart at line 107 "return Future.value();"
  1. if I run using terminal it gives me this error:
    Error: Unexpected null value.
    at Object.throw_ [as throw] (http://localhost:53848/dart_sdk.js:5348:11)
    at Object.nullCheck (http://localhost:53848/dart_sdk.js:5681:30)
    at login_page._LoginPageState.new.movetoHome (http://localhost:53848/packages/learning/pages/login_page.dart.lib.js:644:28)
    at movetoHome.next ()
    at runBody (http://localhost:53848/dart_sdk.js:39250:34)
    at Object._async [as async] (http://localhost:53848/dart_sdk.js:39281:7)
    at login_page._LoginPageState.new.movetoHome (http://localhost:53848/packages/learning/pages/login_page.dart.lib.js:643:20)
    at http://localhost:53848/packages/learning/pages/login_page.dart.lib.js:677:569
    at ink_well._InkResponseState.new.[_handleTap] (http://localhost:53848/packages/flutter/src/material/icon_button.dart.lib.js:50393:31)
    at tap.TapGestureRecognizer.new.invokeCallback (http://localhost:53848/packages/flutter/src/gestures/recognizer.dart.lib.js:194:18)
    at tap.TapGestureRecognizer.new.handleTapUp (http://localhost:53848/packages/flutter/src/gestures/tap.dart.lib.js:408:40)
    at tap.TapGestureRecognizer.new.[_checkUp] (http://localhost:53848/packages/flutter/src/gestures/tap.dart.lib.js:214:12)
    at tap.TapGestureRecognizer.new.handlePrimaryPointer (http://localhost:53848/packages/flutter/src/gestures/tap.dart.lib.js:160:23)
    at tap.TapGestureRecognizer.new.handleEvent (http://localhost:53848/packages/flutter/src/gestures/recognizer.dart.lib.js:449:16)
    at pointer_router.PointerRouter.new.[_dispatch] (http://localhost:53848/packages/flutter/src/gestures/pointer_router.dart.lib.js:93:9)
    at http://localhost:53848/packages/flutter/src/gestures/pointer_router.dart.lib.js:128:26
    at LinkedMap.new.forEach (http://localhost:53848/dart_sdk.js:26346:11)
    at pointer_router.PointerRouter.new.[_dispatchEventToRoutes]
    (http://localhost:53848/packages/flutter/src/gestures/pointer_router.dart.lib.js:125:29)
    at pointer_router.PointerRouter.new.route (http://localhost:53848/packages/flutter/src/gestures/pointer_router.dart.lib.js:117:37)
    at binding$5.WidgetsFlutterBinding.new.handleEvent (http://localhost:53848/packages/flutter/src/gestures/binding.dart.lib.js:389:26)
    at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:53848/packages/flutter/src/gestures/binding.dart.lib.js:372:24)
    at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:53848/packages/flutter/src/rendering/layer.dart.lib.js:5376:13)
    at binding$5.WidgetsFlutterBinding.new.[_handlePointerEventImmediately]
    (http://localhost:53848/packages/flutter/src/gestures/binding.dart.lib.js:343:14)
    at binding$5.WidgetsFlutterBinding.new.handlePointerEvent
    (http://localhost:53848/packages/flutter/src/gestures/binding.dart.lib.js:316:43)
    at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue]
    (http://localhost:53848/packages/flutter/src/gestures/binding.dart.lib.js:305:14)
    at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket]
    (http://localhost:53848/packages/flutter/src/gestures/binding.dart.lib.js:295:65)
    at Object.invoke1 (http://localhost:53848/dart_sdk.js:186355:7)
    at _engine.EnginePlatformDispatcher..invokeOnPointerDataPacket (http://localhost:53848/dart_sdk.js:166281:15)
    at _engine.PointerBinding.
    .[_onPointerData] (http://localhost:53848/dart_sdk.js:166941:49)
    at http://localhost:53848/dart_sdk.js:167399:28
    at http://localhost:53848/dart_sdk.js:167352:16
    at http://localhost:53848/dart_sdk.js:167045:11
@amirhsn
Copy link

amirhsn commented Jul 4, 2021

please provide the full code, this is hard to me to understand what the problem you're facing, but from the error message, it says that your function is returning a null value, but the forward sink need to be fulfilled by a non null value, because the type is Future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants