Files
sdk/utils/apidoc/lib/metadata.dart
T
floitsch@google.com 65718c56df Rename XMatching to XWhere.
For example firstMatching -> firstWhere.

BUG= http://dartbug.com/8664
BUG= http://dartbug.com/8337

Review URL: https://codereview.chromium.org//12537009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19880 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-12 17:34:49 +00:00

15 lines
500 B
Dart

library metadata;
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
/// Returns the metadata for the given string or null if not found.
InstanceMirror findMetadata(List<InstanceMirror> metadataList, String find) {
return metadataList.firstWhere(
(metadata) {
if (metadata is TypeInstanceMirror) {
return metadata.representedType.simpleName == find;
}
return metadata.type.simpleName == find;
}, orElse: () => null);
}