getBestConstructorFor method

ConstructorReflection<O>? getBestConstructorFor({
  1. Iterable<String> requiredParameters = const <String>[],
  2. Iterable<String> optionalParameters = const <String>[],
  3. Iterable<String> nullableParameters = const <String>[],
  4. Iterable<String> presentParameters = const <String>[],
  5. bool jsonName = false,
})

Returns the best ConstructorReflection for requiredParameters, optionalParameters, nullableParameters and presentParameters.

See getBestConstructorsFor.

Implementation

ConstructorReflection<O>? getBestConstructorFor({
  Iterable<String> requiredParameters = const <String>[],
  Iterable<String> optionalParameters = const <String>[],
  Iterable<String> nullableParameters = const <String>[],
  Iterable<String> presentParameters = const <String>[],
  bool jsonName = false,
}) {
  var constructors = getBestConstructorsFor(
    requiredParameters: requiredParameters,
    optionalParameters: optionalParameters,
    nullableParameters: nullableParameters,
    presentParameters: presentParameters,
    jsonName: jsonName,
  );

  return constructors.firstOrNull;
}