platform/lib/src/fast_name_from_symbol.dart
2017-09-22 00:48:22 -04:00

10 lines
267 B
Dart

final Map<Symbol, String> _cache = {};
String fastNameFromSymbol(Symbol s) {
return _cache.putIfAbsent(s, () {
String str = s.toString();
int open = str.indexOf('"');
int close = str.lastIndexOf('"');
return str.substring(open + 1, close);
});
}