validateTarget<T> static method
Validate target type for instance methods/getters.
Throws ArgumentError if target is not the expected type.
Implementation
static T validateTarget<T>(Object? target, String typeName) {
if (target is T) {
return target;
}
throw ArgumentD4rtException(
'Invalid target: expected $typeName, got ${target?.runtimeType}',
);
}