getCanonicalName abstract method
Gets the canonical name with complete generic type information.
Returns:
- The complete type signature including all generic parameters
- Differs from getName by preserving exact generic specifications
- Used for precise type matching and cache keys
Canonical vs Name
- getName(): May return simplified or display-friendly names
- getCanonicalName(): Always returns complete, unambiguous type signature
Example:
final mapClass = Class.forType<Map<String, List<int>>>();
print(mapClass.getName()); // May return 'Map'
print(mapClass.getCanonicalName()); // Returns 'Map<String, List<int>>'
Use Cases
- Type equality comparisons
- Cache key generation
- Serialization/deserialization
- Generic type preservation
Implementation
String getCanonicalName();