1

After adding the screenshot package on my flutter app,my app can not be build and it gives me this error :

: Error: Undefined name 'View'.
screenshot.dart:154
        context == null ? fallBackView : View.maybeOf(context) ?? fallBackView;
                                         ^^^^
: Error: No named parameter with the name 'view'.
screenshot.dart:164
      view: view,
      ^^^^
/C:/src/FlutterSDK/flutter/packages/flutter/lib/src/rendering/view.dart:68:3: Context: Found this candidate, but the arguments don't match.
  RenderView({
  ^^^^^^^^^^

Target kernel_snapshot failed: Exception
2

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\FlutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\FlutterSDK\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.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1

any suggestions can be helpful.thank you in advance.

taha kalaee
  • 133
  • 5

1 Answers1

1

There are many solutions here are they:

1- You can run Flutter Doctor on a PC by using the command prompt. you can open the command prompt by: Clicking on the Windows Start button. Typing in command prompt and pressing Enter.

Once we have the command prompt open, you can type the following and hit enter:

flutter doctor -v

2- Then try to restart your IDE if you had android studio go and delete cache from the

File > Invalidate Cache clears project structure related information (only) cached by Android studio.

3- if it didn't work try changing the package version number

4- lastly delete the package and replace it with another one either from github.com or pub.dev

Thats my solution I hope it works, all the best!

SaifAlmajd
  • 34
  • 4