Open salehmalik121 opened 3 years ago
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
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; }); } }
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