Group Group Group Group Group Group Group Group Group

Exception thrown using Chapter 12's final project, 2nd edition

======== Exception caught by widgets library =======================================================
The following _CastError was thrown building FutureBuilder<Response<Result<APIRecipeQuery>>>(dirty, state: _FutureBuilderState<Response<Result<APIRecipeQuery>>>#7838d):
type 'Null' is not a subtype of type 'Success<dynamic>' in type cast

The relevant error-causing widget was: 
  FutureBuilder<Response<Result<APIRecipeQuery>>> FutureBuilder:file:///Users/danny.sun/Developer/GitHub/flta-materials/12-using-the-chopper-library/projects/final/lib/ui/recipes/recipe_list.dart:195:12
When the exception was thrown, this was the stack: 
#0      _RecipeListState._buildRecipeLoader.<anonymous closure> (package:recipes/ui/recipes/recipe_list.dart:219:33)
#1      _FutureBuilderState.build (package:flutter/src/widgets/async.dart:782:55)
#2      StatefulElement.build (package:flutter/src/widgets/framework.dart:4782:27)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4665:15)
#4      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#5      Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2620:33)
#7      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#8      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#11     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#15     _invoke (dart:ui/hooks.dart:166:10)
#16     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#17     _drawFrame (dart:ui/hooks.dart:129:31)
(elided 3 frames from dart:async)

@gfg_mobile can you set a breakpoint and check what error response you are getting from the api?

Seems like you are not getting any results from the server. But then again we should be handling this error properly if it’s null.