简体   繁体   中英

Dart 2.0 type annotations

I'm updating one of my packages to use the latest linter rules, given this :-

Map<dynamic,dynamic>obj = Map<dynamic,dynamic>();
P p = P();
String nodename ="name";
obj[nodeName] = [obj[nodeName], p];

At the opening bracket of the list on the rhs of the equals I'm getting :-

Specify Type Annotations

Question is why, what does it want me to do here?

This is a List literal [obj[nodeName], p]; without a generic type.

latest linter rules

is not very specific, but there are rules that require the types to be specified

obj[nodeName] = <dynamic>[obj[nodeName], p];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM