TypeEntity class final
Constructs a Entity
representation by replacing occurrences of Object
or dynamic
in the baseType
with corresponding values from subTypes
.
The replacements are applied sequentially based on their order in
subTypes
.
If no subTypes
are provided, the method returns the baseType
as-is
(after trimming spaces).
Examples:
// Example 1: Replacing multiple generic placeholders
final type1 = TypeEntity(Map<Object, Object>, [String, int]);
print(type1); // Output: Map<String,int>
// Example 2: Replacing `dynamic`
final type2 = TypeEntity('List<dynamic>', ['int']);
print(type2); // Output: List<int>
// Example 3: Handling non-generic types
final type3 = TypeEntity(int);
print(type3); // Output: int
// Example 4: More complex generics
final type4 = TypeEntity(Map<dynamic, List<Object>>, ['String', 'int']);
print(type4); // Output: Map<String,List<int>>
Constructors
-
TypeEntity.new(Object baseType, [List<
Object> subTypes = const []]) -
factory
Properties
Methods
-
isDefault(
) → bool -
inherited
-
isNotDefault(
) → bool -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
preferOverDefault(
Entity other) → Entity -
Returns
other
ifthis
is DefaultEntity, otherwise returnsthis
.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited