SachinGanesh / screenshot

Flutter Screenshot Library
https://pub.dev/packages/screenshot
MIT License
343 stars 141 forks source link

No named parameter with the name 'size' :: vs. 2.3.0 issue with Flutter (Channel master, 3.21.0-9.0.pre.29, on macOS) #169

Closed Isa41 closed 4 months ago

Isa41 commented 6 months ago

I have taken this error for 2 days. How can I handle this issue. Anyone help ?

Error (Xcode): ../../../.pub-cache/hosted/pub.dev/screenshot-2.3.0/lib/screenshot.dart:164:9: Error: No named parameter with the name 'size'.

Could not build the application for the simulator. ::: No named parameter with the name 'size'.

wegzwegz commented 6 months ago

Hi I have the same issue : Flutter version : 3.21.0-11.0.pre.47 screenshot version : ^2.3.0

Isa41 commented 6 months ago

Hi wegzwegz,I think I realised why it happens. Now flutter stable version is 3.19.3, so you dont use stable version. If you downgrade you flutter to stable version, issue will gone. Now it is working for me. Have a good code

ritolika commented 6 months ago

https://github.com/ritolika/screenshot/commit/1a09fa017834f4909fbf629023179ce0a102d941


      view: view,
      child: RenderPositionedBox(
          alignment: Alignment.center, child: repaintBoundary),
      // configuration: ViewConfiguration(
      //   size: logicalSize,
      //   devicePixelRatio: pixelRatio ?? 1.0,
      // ),
      configuration: ViewConfiguration.fromView(view)
    );```
ritheshSalyan commented 6 months ago

Hi, This issue occurred because of some API Changes in Flutter.

So, We have released 2 new versions :

2.2.0 - Use this version if you are in the beta/master channel. Or if you get error No named parameter with the name 'size'.

2.3.0 - Use this version if you are in the Stable channel. Or if you get error No named parameter with the name 'constraints'.

appregion commented 6 months ago

@ritheshSalyan

Hi, This issue occurred because of some API Changes in Flutter.

So, We have released 2 new versions :

2.2.0 - Use this version if you are in the beta/master channel. Or if you get error No named parameter with the name 'size'.

2.3.0 - Use this version if you are in the Stable channel. Or if you get error No named parameter with the name 'constraints'.

Hi, I am on Channel master, 3.22.0-5.0.pre.37 and with the screenshot 2.2.0 I get the following error: Error: No named parameter with the name 'constraints'.

If I use 2.3.0 I get: No named parameter with the name 'size'.

So, both options don't work for me.

yahooooza commented 5 months ago

For me i solved the issue by changing the already mentioned code to this. Worked for me on Flutter (Channel master, 3.22.0-16.0.pre.57) Here is my Reference: https://github.com/flutter/flutter/issues/141562#issuecomment-1894740176

final RenderView renderView = RenderView(
      view: view,
      child: RenderPositionedBox(
          alignment: Alignment.center, child: repaintBoundary),
      configuration: ViewConfiguration(
        physicalConstraints: BoxConstraints.tight(logicalSize) * (pixelRatio ?? 1.0),
        logicalConstraints: BoxConstraints.tight(logicalSize),
        devicePixelRatio: pixelRatio ?? 1.0,
      ),
    );
federicopolesello commented 5 months ago

Hi @ritheshSalyan! Any news? The issue still persist in the beta/master channel at the moment and it seems that the Flutter team will not change his decision on this breaking change. We need a fix for this on your side, no?

ritheshSalyan commented 5 months ago

Hi @all,

We have Pushed a commit to work with master channel. Please Use the latest commit from git.

screenshot:
    git: 
       url: https://github.com/SachinGanesh/screenshot.git
federicopolesello commented 5 months ago

@ritheshSalyan Awesome thanks! I'll try it tomorrow. And when will you release a new screenshot's package pub.dev version with this fix?

sgehrman commented 4 months ago

? New flutter 3.22 now fails. Why taking so long to update?

ZionPi commented 4 months ago

@ritheshSalyan github solution works under Flutter 3.22.0 • channel stable

ritheshSalyan commented 4 months ago

Hi @All , We have published latest version screenshot: ^3.0.0 to pub.dev.