[Solved] Chapter 1 Start - Doesn't run

The starter project for the first chapter doesn’t run. I’ve already cleared some obstacles like

  • Updating Android SDK version
01-setting-up-your-environment/projects/starter/android/app/build.gradle

 android {
-    compileSdkVersion 31
+    compileSdkVersion 33
01-setting-up-your-environment/projects/starter/pubspec.yaml

+dependency_overrides:
+  firebase_core_platform_interface: 4.5.1

Now the project is building, but it fails to run throwing following exception

======== Exception caught by widgets library =======================================================
The following _TypeError was thrown attaching to the render tree:
type '<Y0>(String, {Map<String, String>? queryParameters}) => NavigationResult<Y0>' is not a subtype of type '((String) => void)?'

When the exception was thrown, this was the stack: 
#0      _WonderWordsState.initState (package:wonder_words/main.dart:121:31)
#1      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5101:55)
#2      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#3      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#4      Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#5      RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1176:16)
#6      RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1145:5)
#7      RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1092:18)
#8      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2682:19)
#9      RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1091:13)
#10     WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:926:7)
#11     WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:906:7)
#22     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
(elided 10 frames from class _Timer, dart:async, and dart:async-patch)
====================================================================================================

Being a newbie this is not solvable for me. Any advice is appreciated.

Solved it.

Instead of using keyword dynamic from 3 errors in any main.dart, I went for the types

late final FavQsApi _favQsApi = FavQsApi

late final RoutemasterDelegate _routerDelegate = RoutemasterDelegate
3 Likes

@wolkenschieber
Thanks a lot — this helped me!