dart-analyzer

Symbol with private identifier argument

余生长醉 提交于 2020-01-23 02:51:32
问题 I want to create a symbol equal to that of a private MethodMirror's simplename. However, Symbol's documentation states the argument of new Symbol must be a valid public identifier. If I try and create a const Symbol('_privateIdentifier') dart editor informs me that evaluation of this constant expression will throw an exception - though the program runs fine, and I am able to use it without any issues. void main(){ //error flagged in dart editor, though runs fine. const s = const Symbol('_s');

Symbol with private identifier argument

与世无争的帅哥 提交于 2020-01-23 02:51:06
问题 I want to create a symbol equal to that of a private MethodMirror's simplename. However, Symbol's documentation states the argument of new Symbol must be a valid public identifier. If I try and create a const Symbol('_privateIdentifier') dart editor informs me that evaluation of this constant expression will throw an exception - though the program runs fine, and I am able to use it without any issues. void main(){ //error flagged in dart editor, though runs fine. const s = const Symbol('_s');

How to get the subtypes of a generic type using `DartType` from `analyzer` package?

可紊 提交于 2019-12-24 00:52:51
问题 How can I get the subtypes of an element using the class DartType from the analyzer package? for example if the type is List<String> , I would like to get String . Also will be useful to get if the type is generic . Another more complex example would be Map<String, String> where I want to get a list of the subtypes, in this case: [String, String] . 回答1: This one is a little tricky - because DartType actually itself has some super types - the one that will interest you here is

Symbol with private identifier argument

倖福魔咒の 提交于 2019-12-04 16:19:53
I want to create a symbol equal to that of a private MethodMirror's simplename. However, Symbol's documentation states the argument of new Symbol must be a valid public identifier. If I try and create a const Symbol('_privateIdentifier') dart editor informs me that evaluation of this constant expression will throw an exception - though the program runs fine, and I am able to use it without any issues. void main(){ //error flagged in dart editor, though runs fine. const s = const Symbol('_s'); print(s); //Symbol("_s"); } It seems the mirror system uses symbols. import 'dart:mirrors'; class

Suppress hint about use of protected member

北城以北 提交于 2019-11-28 04:28:34
问题 The meta package provides a @protected annotation (besides others) to get analyzer hints or warnings about the use of protected members outside of direct subclasses. INFO: The member 'selectedChildrenChanged' can only be used within instance members of subclasses of 'MenuItem' ([bwu_ng_quick_nav] test/menu_item_test.dart:108) I'm not interested in these hints in my unit tests. How can I suppress such hints? 回答1: The suppression code for the @protected hint is INVALID_USE_OF_PROTECTED_MEMBER .