deobfuscate method

String deobfuscate(
  1. Object object
)

Deobfuscates public class names using the mapping file generated at build time.

Names are not expected to change for the lifetime of the app, and are cached per runtime type.

This function drops generic type parameters to simplify mapping and help selectors conform to patterns used by the other Fullstory SDKs.

Implementation

String deobfuscate(Object object) {
  final type = object.runtimeType;
  final cached = _cache[type];
  if (cached != null) {
    return cached;
  }

  final obfuscatedName = _trimGeneric(type);
  final deobfuscatedName = _map[obfuscatedName];
  if (deobfuscatedName != null) {
    _cache[type] = deobfuscatedName;
  } else {
    _cache[type] = obfuscatedName;
  }

  return deobfuscatedName ?? obfuscatedName;
}