OLD | NEW |
1 library metadata; | 1 library metadata; |
2 | 2 |
3 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/source_mirror
s.dart'; | 3 import '../../../pkg/compiler/lib/src/mirrors/source_mirrors.dart'; |
4 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; | 4 import '../../../pkg/compiler/lib/src/mirrors/mirrors_util.dart'; |
5 | 5 |
6 /// Returns the metadata for the given string or null if not found. | 6 /// Returns the metadata for the given string or null if not found. |
7 InstanceMirror findMetadata(List<InstanceMirror> metadataList, String find) { | 7 InstanceMirror findMetadata(List<InstanceMirror> metadataList, String find) { |
8 return metadataList.firstWhere( | 8 return metadataList.firstWhere( |
9 (metadata) { | 9 (metadata) { |
10 if (metadata is TypeInstanceMirror) { | 10 if (metadata is TypeInstanceMirror) { |
11 return nameOf(metadata.representedType) == find; | 11 return nameOf(metadata.representedType) == find; |
12 } | 12 } |
13 return nameOf(metadata.type) == find; | 13 return nameOf(metadata.type) == find; |
14 }, orElse: () => null); | 14 }, orElse: () => null); |
15 } | 15 } |
OLD | NEW |