getRequiredArgTodoDefault<T> static method

T getRequiredArgTodoDefault<T>(
  1. List<Object?> positional,
  2. int index,
  3. String paramName,
  4. String methodName,
  5. String originalDefault,
)

Helper for parameters with non-wrappable defaults.

The original Dart code has a default value that cannot be expressed in the bridge (e.g., class static members, private constants, complex expressions). This forces the caller to provide a value at runtime.

Throws ArgumentError if the value is null.

Implementation

static T getRequiredArgTodoDefault<T>(
  List<Object?> positional,
  int index,
  String paramName,
  String methodName,
  String originalDefault,
) {
  if (positional.length <= index || positional[index] == null) {
    throw ArgumentD4rtException(
      '$methodName: Parameter "$paramName" has non-wrappable default ($originalDefault). '
      'Value must be specified but was null.',
    );
  }
  return extractBridgedArg<T>(positional[index], paramName);
}