existingComponent method

dynamic existingComponent(
  1. String name, {
  2. Map<String, DslType>? params,
})

Returns a callable handle for a component that already exists in the current target project.

This is an alias for projectComponent with a brownfield-oriented name. The handle can be used in new layouts, item builders, and anywhere a component invocation is accepted.

final tripCard = app.existingComponent('TripCard');

Implementation

dynamic existingComponent(String name, {Map<String, DslType>? params}) {
  recordExistingReference(
    name: name,
    kind: 'component',
    referenceApi: 'existingComponent',
    removeApi: 'removeComponent',
  );
  _rejectReservedComponentParamNames(name, params);
  return ExistingProjectComponentHandle(name, params: params);
}