0

Am getting an error, which seems to be from an internal package dependency navigator.dart

Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on Android SDK built for x86 in debug mode... /C:/Users/.../AppData/Local/Pub/Cache/hosted/pub.dev/states_rebuilder-4.4.0/lib/src/navigate/rm_navigator.dart:167:44: Error: The method 'copyWith' isn't defined for the class 'RouteSettings'.

  • 'RouteSettings' is from 'package:flutter/src/widgets/navigator.dart' ('/D:/FlutterSDK/packages/flutter/lib/src/widgets/navigator.dart'). Try correcting the name to the name of an existing method, or defining a method named 'copyWith'. final p = resolvePage(settings.copyWith(name: n)); ^^^^^^^^ /C:/Users/.../AppData/Local/Pub/Cache/hosted/pub.dev/states_rebuilder-4.4.0/lib/src/navigate/rm_navigator.dart:227:27: Error: The method 'copyWith' isn't defined for the class 'RouteSettings'.
  • 'RouteSettings' is from 'package:flutter/src/widgets/navigator.dart' ('/D:/FlutterSDK/packages/flutter/lib/src/widgets/navigator.dart'). Try correcting the name to the name of an existing method, or defining a method named 'copyWith'. settings = settings.copyWith(name: absolutePath); ^^^^^^^^ /C:/Users/.../AppData/Local/Pub/Cache/hosted/pub.dev/states_rebuilder-4.4.0/lib/src/navigate/rm_navigator.dart:613:29: Error: The argument type 'bool?' can't be assigned to the parameter type 'bool' because 'bool?' is nullable and 'bool' isn't. semanticsDismissible: semanticsDismissible, ^ Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • Where: Script 'D:\FlutterSDK\packages\flutter_tools\gradle\flutter.gradle' line: 1201

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'D:\FlutterSDK\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 1m 22s Running Gradle task 'assembleDebug'...
83.8s Exception: Gradle task assembleDebug failed with exit code 1

I am using Editor: VS Code

Below is the output from flutter doctor -v

[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.22621.1992], locale en-GB) • Flutter version 3.10.6 on channel stable at d:\FlutterSDK • Upstream repository https://github.com/flutter/flutter.git • Framework revision f468f3366c (3 weeks ago), 2023-07-12 15:19:05 -0700 • Engine revision cdbeda788a • Dart version 3.0.6 • DevTools version 2.23.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Users...\AppData\Local\Android\sdk • Platform android-33, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.4.33110.190 X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components: MSVC v142 - VS 2019 C++ x64/x86 build tools - If there are multiple build tool versions available, install the latest C++ CMake tools for Windows Windows 10 SDK

[√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.80.2) • VS Code at C:\Users...\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.68.0

[√] Connected device (4 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1992] • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.248 • Edge (web) • edge • web-javascript • Microsoft Edge 115.0.1901.188

[√] Network resources • All expected network resources are available.

! Doctor found issues in 1 category.

I've done flutter pub upgrade, but still the error persists

1 Answer 1

0

Found the issue - ran flutter pub deps to get a tree view of all the dependencies, to see which one was using the offending package.

├── animator 3.1.0
│   ├── flutter...
│   └── states_rebuilder4.4.0
│       ├── collection... 
│       └── flutter... 
├── cached_network_image 3.2.3

So, it was animator package, using states_rebuilder, which had the offending code. Removed the package altogether and it now builds just fine

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.