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

[BUG] dependency overrides cause malfunction in fvm commands #683

Open
3 of 4 tasks
kputh opened this issue Mar 7, 2024 · 2 comments
Open
3 of 4 tasks

[BUG] dependency overrides cause malfunction in fvm commands #683

kputh opened this issue Mar 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@kputh
Copy link

kputh commented Mar 7, 2024

Before creating a bug report please make check the following

  • You have read our FAQ
  • If you have used flutter. Please install correctly, run pub cache repair. Close the terminal and try again.
  • If you are on Windows. Make sure you are running the terminal as administrator or with developer permissions.
  • Run fvm doctor if possible and add the output to the issue.

Describe the bug
Commands like fvm use fail with a complicated error message when specific dependency overrides are present.

Example dependency override in pubspec.yaml:

dependency_overrides:
  geolocator_android:
    hosted:
      name: geolocator_android
      url: https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss

Example error message:

$ fvm use 3.10.4 --verbose

Argument information:
  Top level options:
  - verbose: true

Command: use

Searching for project in /Users/kaiputh/Downloads/faulty_override/fluffychat

Unhandled exception:
type 'Null' is not a subtype of type 'String'
#0      new ExternalHostedReference.fromJson (package:pubspec/src/dependency.dart:138)
#1      new DependencyReference.fromJson (package:pubspec/src/dependency.dart:25)
#2      new PubSpec.fromJson.<anonymous closure> (package:pubspec/src/pubspec.dart:107)
#3      JsonParser.mapValues.<anonymous closure> (package:pubspec/src/json_utils.dart:113)
#4      MapBase.forEach (dart:collection/maps.dart:35)
#5      JsonParser.mapValues (package:pubspec/src/json_utils.dart:112)
#6      new PubSpec.fromJson (package:pubspec/src/pubspec.dart:110)
#7      new PubSpec.fromYamlString (package:pubspec/src/pubspec.dart:120)
#8      Project.loadFromPath (package:fvm/src/models/project_model.dart:75)
#9      ProjectService.findAncestor (package:fvm/src/services/project_service.dart:42)
#10     UseCommand.run (package:fvm/src/commands/use_command.dart:69)
#11     CommandRunner.runCommand (package:args/command_runner.dart:212)
#12     FvmCommandRunner.runCommand (package:fvm/src/runner.dart:235)
#13     FvmCommandRunner.run (package:fvm/src/runner.dart:117)
#14     main.<anonymous closure> (file:///private/tmp/fvm-20240307-64738-1l9q2g/fvm-3.0.13/bin/main.dart:13)
#15     _rootRun (dart:async/zone.dart:1399)
#16     _CustomZone.run (dart:async/zone.dart:1301)
#17     _runZoned (dart:async/zone.dart:1804)
#18     runZoned (dart:async/zone.dart:1747)
#19     Scope.run (package:scope/src/scope.dart:151)
#20     main (file:///private/tmp/fvm-20240307-64738-1l9q2g/fvm-3.0.13/bin/main.dart:13)
#21     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295)
#22     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184)

To Reproduce

git clone https://github.com/krille-chan/fluffychat.git
cd fluffychat 
fvm use 3.10.4

Then, remove the dependency override for geolocator_android from pubspec.yaml and run fvm use 3.10.4again.

Expected behavior
The command should complete successfully.

Desktop:

$ fvm --version
3.0.13
$ fvm doctor 
FVM Doctor:                                                                     
--------------------------------------------------------------------------------
Project:
┌─────────────────────────────┬─────────────────────────────────────────────────────┐
│ Project                     │ fluffychat                                          │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Directory                   │ /Users/kaiputh/Downloads/faulty_override/fluffychat │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Active Flavor               │ None                                                │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Is Flutter Project          │ Yes                                                 │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Dart Tool Generator Version │ Not available                                       │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Dart tool version           │ Not available                                       │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ .gitignore Present          │ Yes                                                 │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Config Present              │ No                                                  │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Pinned Version              │ None                                                │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Config path                 │ .fvmrc                                              │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Local cache dir             │ .fvm/versions                                       │
├─────────────────────────────┼─────────────────────────────────────────────────────┤
│ Version symlink             │ .fvm/versions                                       │
└─────────────────────────────┴─────────────────────────────────────────────────────┘


IDEs:
┌────────────────────────────────┬─────────────────────────────────────────────────────┐
│ IDEs                           │ Value                                               │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ VSCode                         │                                                     │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ VSCode                         │ No .vscode directory found                          │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ IntelliJ (Android Studio, ...) │                                                     │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ IntelliJ (Android Studio, ...) │ No local.properties file found in android directory │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ IntelliJ (Android Studio, ...) │ No .idea folder found                               │
└────────────────────────────────┴─────────────────────────────────────────────────────┘

Environment:
┌────────────────────────┬────────────────────────────────────┐
│ Environment Variables  │ Value                              │
├────────────────────────┼────────────────────────────────────┤
│ Flutter PATH           │ /Users/kaiputh/flutter/bin/flutter │
├────────────────────────┼────────────────────────────────────┤
│ Dart PATH              │ /Users/kaiputh/flutter/bin/dart    │
├────────────────────────┼────────────────────────────────────┤
│ FVM_CACHE_PATH         │ N/A                                │
├────────────────────────┼────────────────────────────────────┤
│ FVM_USE_GIT_CACHE      │ N/A                                │
├────────────────────────┼────────────────────────────────────┤
│ FVM_GIT_CACHE_PATH     │ N/A                                │
├────────────────────────┼────────────────────────────────────┤
│ FVM_FLUTTER_URL        │ N/A                                │
├────────────────────────┼────────────────────────────────────┤
│ FVM_PRIVILEDGED_ACCESS │ N/A                                │
├────────────────────────┼────────────────────────────────────┤
│ Flutter PATH           │ /Users/kaiputh/flutter/bin/flutter │
├────────────────────────┼────────────────────────────────────┤
│ Dart PATH              │ /Users/kaiputh/flutter/bin/dart    │
└────────────────────────┴────────────────────────────────────┘
┌──────────────┬────────────────────────────────────────────────────────────────┐
│ Platform     │ Value                                                          │
├──────────────┼────────────────────────────────────────────────────────────────┤
│ OS           │ macos Version 13.6.4 (Build 22G513)                            │
├──────────────┼────────────────────────────────────────────────────────────────┤
│ Dart Locale  │ de-DE                                                          │
├──────────────┼────────────────────────────────────────────────────────────────┤
│ Dart runtime │ 3.2.6 (stable) (Wed Jan 24 13:41:58 2024 +0000) on "macos_x64" │
└──────────────┴────────────────────────────────────────────────────────────────┘
@kputh kputh added the bug Something isn't working label Mar 7, 2024
@suxoikorm
Copy link

Same problem but I don't have dependency overrides, i have self hosted pub packages

some_package: hosted: https://self.hosted.pub.com/

When I removed this packages everything works, but with this packages I have same error.

@leoafarias
Copy link
Owner

I just checked the repo, and it seems that this is "invalid" for the hosted dependency. I did further research and found the following:

j4qfrost/pubspec#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants