David Kiarie Macharia
David Kiarie Macharia

Reputation: 289

Error: Too many positional arguments: 1 allowed, but 2 found. Try removing the extra positional arguments. super.addToScene(builder, layerOffset);

I got this error after upgraded to flutter 2.8 from 2.5 ,run flutter clean but could not be resolved
../../flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.2.0/lib/src/visibility_detector_layer.dart:276:21: Error: Too many positional arguments: 1 allowed, but 2 found. Try removing the extra positional arguments. super.addToScene(builder, layerOffset); flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 11.5.2 20G95 darwin-arm, locale en-KE)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 13.2)
✗ CocoaPods installed but not working.
    You appear to have CocoaPods installed but it is not working.
    This can happen if the version of Ruby that CocoaPods was installed with is   different from the one
    being used to invoke it.
    This can usually be fixed by re-installing CocoaPods.
  To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for
  instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2021.3)
[✓] VS Code (version 1.63.0)
 [✓] Connected device (1 available)
! Doctor found issues in 3 categories.

flutter version

Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (2 days ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1

code was working very well on 2.5 until upgrade

Upvotes: 11

Views: 3843

Answers (2)

persec10000
persec10000

Reputation: 1065

  1. open following file from flutter installed path. flutter/.pub-cache/hosted/pub.dartlang.org/firexcode-1.0.8/lib/src/Modules/visibility_detector/visibility_detector_layer.dart

  2. update code part at line:276

From

super.addToScene(builder, layerOffset);

To

super.addToScene(builder/*, layerOffset*/);
  1. Then Build again, it will worked.

Upvotes: 1

KnightsForce
KnightsForce

Reputation: 539

Use visibility_detector 0.2.2.

Upvotes: 10

Related Questions