0

this is my error after running flutter run command it shows gradle debug running. /C:/Users/Rasul/AppData/Local/Pub/Cache/hosted/pub.dev/preload_page_view-0.1.6/lib/preload_page_view.dart:179:15: Error: The method 'PageMetrics.copyWith' doesn't have the named parameter 'devicePixelRatio' of overridden method 'Object with ScrollMetrics.copyWith'. PageMetrics copyWith({ ^ /C:/flutter/packages/flutter/lib/src/widgets/scroll_metrics.dart:138:7: Context: This is the overridden method ('copyWith').
class FixedScrollMetrics with ScrollMetrics { ^ /C:/Users/Rasul/AppData/Local/Pub/Cache/hosted/pub.dev/preload_page_view-0.1.6/lib/preload_page_view.dart:302:15: Error: The method '_PagePosition.copyWith' doesn't have the named parameter 'devicePixelRatio' of overridden method 'ViewportOffset with ScrollMetrics.copyWith'. PageMetrics copyWith({ ^ /C:/flutter/packages/flutter/lib/src/widgets/scroll_position.dart:92:16: Context: This is the overridden method ('copyWith').
abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { ^ /C:/Users/Rasul/AppData/Local/Pub/Cache/hosted/pub.dev/preload_page_view-0.1.6/lib/preload_page_view.dart:170:13: Error: Required named parameter 'devicePixelRatio' must be provided. }) : super( ^ /C:/Users/Rasul/AppData/Local/Pub/Cache/hosted/pub.dev/fluro-2.0.3/lib/src/fluro_router.dart:134:37: Error: The method 'copyWith' isn't defined for the class 'RouteSettings'.

  • 'RouteSettings' is from 'package:flutter/src/widgets/navigator.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/navigator.dart'). Try correcting the name to the name of an existing method, or defining a method named 'copyWith'. settingsToUse = settingsToUse.copyWith(name: path); ^^^^^^^^ Target kernel_snapshot failed: Exception

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

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

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

Process 'command 'C:\flutter\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. ==============================================================================

2: Task failed with an exception.

  • What went wrong: java.lang.StackOverflowError (no error message)

  • 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 7m 22s.

flutter packages updated successfully with help of flutter pub upgrade. i think everything is correctly pluged in but it shows this error again and again.

1
  • Is this by any chance a project that you cloned from a repository? If so, then there might be a version compatibility issue with the dependencies. If the repo's dependencies are not the newest, then they might conflict with your Flutter version. Commented Aug 19, 2023 at 6:05

1 Answer 1

0

You've to follow some steps.

  1. Run flutter clean
  2. Restart your VS Code/Android Studio
  3. After back to VS Code/Android Studio run - flutter pub get

If your problem doesn't solve, check other projects running successfully or not.

If successful - try back up the necessary code(lib, yaml, etc) and replace with a new project.

Otherwise, - You need to upgrade gradle version in android->build.gradle:dependencies

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.