platform/lib/src/fast_name_from_symbol.dart

11 lines
267 B
Dart
Raw Normal View History

2017-09-22 04:48:22 +00:00
final Map<Symbol, String> _cache = {};
String fastNameFromSymbol(Symbol s) {
2017-09-22 04:48:22 +00:00
return _cache.putIfAbsent(s, () {
String str = s.toString();
int open = str.indexOf('"');
int close = str.lastIndexOf('"');
return str.substring(open + 1, close);
});
}