-
Notifications
You must be signed in to change notification settings - Fork 133
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
Correctly handle nullable type arguments in a number of APIs #711
Correctly handle nullable type arguments in a number of APIs #711
Conversation
04357d8
to
b080810
Compare
@@ -151,7 +151,7 @@ class HashBiMap<K, V> implements BiMap<K, V> { | |||
@override | |||
void updateAll(V Function(K key, V value) update) { | |||
for (final key in keys) { | |||
_add(key, update(key, _map[key]!), true); | |||
_add(key, update(key, _map[key] as V), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handles the nullable V
case correctly!
This could also iterate over entries
to avoid the as
check...
@@ -290,7 +290,7 @@ class LinkedLruHashMap<K, V> implements LruMap<K, V> { | |||
V update(K key, V Function(V value) update, {V Function()? ifAbsent}) { | |||
V newValue; | |||
if (containsKey(key)) { | |||
newValue = update(this[key]!); | |||
newValue = update(this[key] as V); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No way around this, if I understand things correctly
@@ -23,7 +23,7 @@ import 'dart:collection'; | |||
/// With the introduction of non-null by default in Dart SDK 2.12, developers | |||
/// should avoid adding more uses of this type. Existing users should migrate | |||
/// away from the `Optional` type to types marked nullable: `T?`. | |||
class Optional<T> extends IterableBase<T> { | |||
class Optional<T extends Object> extends IterableBase<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably breaking, but if you can pull this through, hats off to you!
No description provided.