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] 'Null' is not a subtype of type 'bool' #281

Closed
kuhnroyal opened this issue May 1, 2021 · 5 comments
Closed

[BUG] 'Null' is not a subtype of type 'bool' #281

kuhnroyal opened this issue May 1, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@kuhnroyal
Copy link
Contributor

Describe the bug
Running fvm flutter pub get with version 2.0.0 in a previously working project (with 1.3.8) yields:

Unhandled exception:
type 'Null' is not a subtype of type 'bool' in type cast
#0      new FvmSettings.fromMap (package:fvm/src/models/settings_model.dart:33:33)
#1      new FvmSettings.fromJson (package:fvm/src/models/settings_model.dart:25:24)
#2      SettingsService.readSync (package:fvm/src/services/settings_service.dart:30:28)
#3      FvmContext.cacheDir (package:fvm/src/services/context.dart:50:39)
#4      versionCacheDir (package:fvm/src/utils/helpers.dart:37:29)
#5      CacheService.getByVersionName (package:fvm/src/services/cache_service.dart:21:24)
#6      CacheService.isVersionCached (package:fvm/src/services/cache_service.dart:87:45)
#7      ensureCacheWorkflow (package:fvm/src/workflows/ensure_cache.workflow.dart:22:45)
#8      FlutterCommand.run (package:fvm/src/commands/flutter_command.dart:30:34)
<asynchronous suspension>
#9      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
<asynchronous suspension>
#10     FvmCommandRunner.run (package:fvm/src/runner.dart:73:24)

It seems that,

      skipSetup: map['skipSetup'] as bool,
      gitCache: map['gitCache'] as bool,

are now both required with NNBD.

To Reproduce
The project is configure with Flutter 2.0.5 in fvm_config.json

@kuhnroyal kuhnroyal added the bug Something isn't working label May 1, 2021
@kuhnroyal
Copy link
Contributor Author

Probably need to change the constructor:

  FvmSettings({
    this.cachePath,
    bool skipSetup,
    bool gitCache,
  }): this.skipSetup = skipSetup ?? false, this.gitCache = gitCache ?? false;

@leoafarias
Copy link
Owner

@kuhnroyal the defaults are being set, it seems the issue happens right before that when is casting the null to bool, will have a fix up soon

@leoafarias
Copy link
Owner

Version 2.0.1 is being built, that should resolve the issue

@kuhnroyal
Copy link
Contributor Author

Thanks! Now you have the defaults set in 2 places. That's why I was suggesting a private constructor :)

@leoafarias
Copy link
Owner

hmmm sorry about that, will take a better look on your suggestion

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

2 participants