-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Additional Breaking Changes for Dart 3.0 #49892
Comments
Platform library changes are very difficult to pull off. Worst case, we need to migrate the world at the same time that we make the change. APIs do not have language versioning, so we can't change behavior based on the language version of the code calling the method. Convering The |
The MapEntry idea is awesome. Whatever you decide, I'm in. But I really liked the typedef idea. |
The problem with making |
Yeah, makes sense. I'm not familiar with the view, if it works, perfect. If it doesn't, dart fix wouldn't be hard. |
The methods could accept |
As much as I want union types (personal favorite request), I don't think it will arrive before views/other things. |
Variable number of arguments
|
@TimWhiting Plus it's not like I had a choice to not upgrade, Dart 2.X will eventually be dropped like Dart 1.X was. |
These were just proposed changes. I'm not part of the dart team, and the map entry change is unlikely to happen at least for dart 3. |
The It won't break existing 2.19 code, but it may require some rewriting when upgrading to language version 3.0. |
I believe Dart 3.0 has the opportunity to make more breaking changes than just only disallowing non-null-safe code.
For example, I have seen in several issues that the dart language team has said, 'if we had null-safety to start with, we would have designed this api differently'.
Feel free to edit or add additional breaking changes to consider / discuss, but here are a few I can think of.
list.first
,list.last
,list.firstWhere
-> change return type to nullable. Migrate existing usages toList.first.. ?? throw ..
. This has the benefit of making it much more explicit to the user where their code can throw. I know I've been bitten by these methods in the past.typedef MapEntry<K,V> = ({K key, V value})
using the Records feature which seems to be progressing quickly. This only breaks implementors/extenders of MapEntry I believe unless someone is relying on identity of the MapEntry object. Searching Github for "implements MapEntry" I see 95 usages in Dart code. (https://github.com/search?l=Dart&p=7&q=%22implements+MapEntry%22&type=Code) Most are copies of theLruCache
's_Link
frompackage:build
or SplayTreeMapNode it looks like, but there are a few which basically just expose another name for the key or value, these can be migrated to extension methods or 'Views'. I'm not sure how to handle the migration of_Link
orSplayTreeMapNode
admittedly..indexed
getter on List (could just be an extension method?) that returns a Record(int index, T value)
The text was updated successfully, but these errors were encountered: