-
Notifications
You must be signed in to change notification settings - Fork 58
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
YamlMap does not sport any type parameters #38
Comments
Same with YamlList. |
I don't know if there's much we can do about this... there are no type guarantees about what these values contain. YAML even allows non-string keys. Ultimately, you have to make an assertion at some point that the values are the types you expect, and Dart as a language strongly encourages you to do that explicitly with |
Can we not just do: class YamlMap<K, V> extends YamlNode with collection.MapMixin<K, V>, UnmodifiableMapMixin ? |
Where would those type parameters ever be instantiated? |
I'm just looking for an implicit cast (another Dart language feature): YamlMap<String, YamlMap> a = ...
a.forEach((String k, YamlMap v) { ... }); How would you suggest using Map.cast? |
Implicit/ You should write something like: var map = /* ... */.cast<String, YamlMap>();
map.forEach((key, value) { ... }); |
This makes it hard to call
forEach
, or other methods that take a callback, without using dynamic as bottom (dart-lang/sdk#29630):The text was updated successfully, but these errors were encountered: