getBestConstructor abstract method

Constructor? getBestConstructor(
  1. List<Class> paramTypes
)

Gets the best constructor for the given parameter types.

Parameters:

  • paramTypes: List of parameter types in exact order

Returns:

  • The best constructor match if found
  • null if no matching signature exists

Example:

class Converter {
  String convert(int value) => value.toString();
  String convert(double value) => value.toString();
}

final constructor = Class.forType<Converter>()
  .getBestConstructor([Class.forType<int>()]);

Implementation

Constructor? getBestConstructor(List<Class> paramTypes);