getParamOrNull<T extends Object> method

T? getParamOrNull<T extends Object>(
  1. int idx
)

Implementation

T? getParamOrNull<T extends Object>(int idx) {
  if(idx < 0 || idx >= params.length) {
    throw AFException("Attempting to access test parameter at $idx but there are only ${params.length} params");
  }

  final obj = params[idx];
  if(obj == null) {
    return null;
  }
  if(obj is! T?) {
    throw AFException("Expected test parameter at $idx to have type ${T.toString()}, but it is a ${obj.runtimeType.toString()}");
  }
  return obj as T?;
}