forType<C> static method

Class<C> forType<C>(
  1. C type, [
  2. ProtectionDomain? domain,
  3. String? package
])

Creates a Class instance for a runtime type.

Type Parameters:

  • Type: The class type to reflect

Parameters:

  • domain: Optional protection domain
  • package: Optional package name to search with

Returns:

  • A Class instance for the type

Example:

final listClass = Class.forType(List<String>);

Implementation

static Class<C> forType<C>(C type, [ProtectionDomain? domain, String? package]) {
  return _Class<C>(type.toString(), domain ?? ProtectionDomain.current(), package);
}