newInstance<T> abstract method

T newInstance<T>(
  1. String name, [
  2. Type? returnType,
  3. List<Object?> args = const [],
  4. Map<String, Object?> namedArgs = const {},
])

Creates a new instance of type T using the specified constructor name.

For the default unnamed constructor, use an empty string '' for name.

  • name: The name of the constructor (e.g., 'named', or '' for default).
  • returnType: The expected return type of the constructor.
  • args: Positional arguments for the constructor.
  • namedArgs: Named arguments for the constructor.

Throws an UnImplementedResolverException if the constructor cannot be resolved.

Implementation

T newInstance<T>(String name, [Type? returnType, List<Object?> args = const [], Map<String, Object?> namedArgs = const {}]);