createClass function

Expression createClass(
  1. ServerClass c, {
  2. Expression? defaultArg,
})

Implementation

Expression createClass(
  ServerClass c, {
  Expression? defaultArg,
}) {
  final (:positioned, :named) = getParams(
    c.params,
    defaultExpression: defaultArg,
  );

  final constructor = refer(c.className).newInstance(positioned, named);

  return constructor;
}