Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError: Closure call with mismatched arguments: function 'MutablePackageTree.allPackages' #2699

Closed
Aoi-hosizora opened this issue May 18, 2020 · 5 comments

Comments

@Aoi-hosizora
Copy link

Aoi-hosizora commented May 18, 2020

I run flutter pub run build_runner build to generate JsonSerializable and retrofit_generator, but get a bug report.

  • Dart SDK Version
    Dart VM version: 2.7.0 (Fri Dec 6 16:26:51 2019 +0100) on "windows_x64"
  • What package(s) from this repo you are using, and the version
    build_runner: ^1.7.3
  • What builder(s) you are using
    retrofit_generator: ^1.3.4+2
    json_serializable: ^3.3.0
  • Whether you are using Windows, MacOSX, or Linux (if applicable)
    Windows 10 1803
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
    Chrome 81.0.4044.138 x86
  • Any other packages or constraints we should know about
dependencies:
  json_annotation: ^3.0.1
  retrofit: ^1.3.4
  dio: ^3.0.8

dev_dependencies:
  build_runner: ^1.7.3
  retrofit_generator: ^1.3.4+2
  json_serializable: ^3.3.0

(before run flutter packages get)

Unhandled exception:
NoSuchMethodError: Closure call with mismatched arguments: function 'MutablePackageTree.allPackages'
Receiver: Closure: (_SyncIterator<Package>) => bool
Tried calling: MutablePackageTree.allPackages()
Found: MutablePackageTree.allPackages(_SyncIterator<Package>) => bool
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      _SyncIterable.iterator (dart:core-patch/core_patch.dart:117:45)
#2      new SimplePackageConfig (package:package_config/src/package_config_impl.dart:26:36)
#3      parsePackageConfigJson (package:package_config/src/package_config_json.dart:213:10)
#4      parsePackageConfigBytes (package:package_config/src/package_config_json.dart:45:10)
#5      readPackageConfigJsonFile (package:package_config/src/package_config_io.dart:117:10)
<asynchronous suspension>
#6      findPackagConfigInDirectory (package:package_config/src/discovery.dart:109:18)
<asynchronous suspension>
#7      findPackageConfig (package:package_config/src/discovery.dart:44:31)
<asynchronous suspension>
#8      findPackageConfig (package:package_config/package_config.dart:114:5)
#9      PackageGraph.forPath (package:build_runner_core/src/package_graph/package_graph.dart:74:15)
#10     PackageGraph.forThisPackage (package:build_runner_core/src/package_graph/package_graph.dart:110:20)
#11     main (file:///C:/Users/Windows%2010/AppData/Roaming/Pub/Cache/hosted/pub.flutter-io.cn/build_runner-1.10.0/bin/build_runner.dart:27:49)
#12     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#13     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
pub finished with exit code 255

(after run flutter packages get)

NoSuchMethodError: Closure call with mismatched arguments: function 'MutablePackageTree.allPackages'
Receiver: Closure: (_SyncIterator<Package>) => bool
Tried calling: MutablePackageTree.allPackages()
Found: MutablePackageTree.allPackages(_SyncIterator<Package>) => bool
dart:core                                                              _SyncIterable.iterator
package:package_config/src/package_config_impl.dart 26:36              new SimplePackageConfig
package:package_config/src/package_config_json.dart 213:10             parsePackageConfigJson
package:package_config/src/package_config_json.dart 45:10              parsePackageConfigBytes
package:package_config/src/package_config_io.dart 117:10               readPackageConfigJsonFile
package:package_config/src/discovery.dart 109:18                       findPackagConfigInDirectory
package:package_config/src/discovery.dart 44:31                        findPackageConfig
package:package_config/package_config.dart 114:5                       findPackageConfig
package:build_runner_core/src/package_graph/package_graph.dart 74:15   PackageGraph.forPath
package:build_runner_core/src/package_graph/package_graph.dart 110:20  PackageGraph.forThisPackage
package:build_runner/src/entrypoint/run.dart 22:64                     run
.dart_tool\build\entrypoint\build.dart 26:22                           main

pub finished with exit code 1
@Aoi-hosizora
Copy link
Author

I just found an related issues :)

https://github.com/dart-lang/package_config/issues/85

@fzyzcjy
Copy link

fzyzcjy commented Jun 28, 2020

Same issue here, did you solve it? (Seems that people in the link does not?)

@Aoi-hosizora
Copy link
Author

@fzyzcjy Just flutter clean and flutter packages get, and rerun flutter run.

@RoyalRajput18
Copy link

Same issue here, did you solve it? (i didn't find any solution here.)

@jakemac53
Copy link
Contributor

See the related issue https://github.com/dart-lang/package_config/issues/85.

If you manually delete your .dart_tool/build directory that should work I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants