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

CastMap does an invalid cast on 'remove' #45473

Closed
stuartmorgan opened this issue Mar 25, 2021 · 5 comments
Closed

CastMap does an invalid cast on 'remove' #45473

stuartmorgan opened this issue Mar 25, 2021 · 5 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@stuartmorgan
Copy link
Contributor

STR:

  final foo = json.decode('{}').cast<String, Object>();
  foo.remove('akey');

V remove(Object? key) => _source.remove(key) as V;
is incorrect, since remove returns a nullable value even if the value type is non-null.

@stuartmorgan
Copy link
Contributor Author

This is causing issues for the very popular shared_preferences plugin on Linux and Windows, so ideally we would cherry-pick a fix for this to stable. (If that's not feasible, we can work around it in the plugin, but I don't think that plugin is going to be the only thing to hit this.)

@devoncarew devoncarew added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core labels Mar 25, 2021
@devoncarew
Copy link
Member

cc @lrhn

@lrhn lrhn added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 27, 2021
@lrhn lrhn self-assigned this Apr 6, 2021
@lrhn
Copy link
Member

lrhn commented May 11, 2021

@lrhn lrhn closed this as completed May 11, 2021
@stuartmorgan
Copy link
Contributor Author

@lrhn Is it possible to cherry-pick this since it's a very straightforward fix?

@lrhn
Copy link
Member

lrhn commented May 12, 2021

Shouldn't be a problem. Not sure where we are in release cycles right now, but if it's cherry-pick season, it would be nice to get it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-core type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants