---
name: Explain code
description: Explain what code does without editing it. Use /explain with a path or symbol; covers GetX state, REST API I/O, routing GetX Navigation, and failure modes. Ask when facts are not in the repo.
---

# Explain — LegacyApp

Explain **what the code is doing** — **do not** change production code unless the user explicitly asks for a fix.

**Stack:** **GetX** / **MVC** / **GetX Navigation** / **REST API** / platforms: ios, android. Package: `com.test.legacy`.

## Usage

```
/explain <file path, widget name, class, or symbol>
```

**Examples:**

- `/explain lib/features/cart/cart_cubit.dart`
- `/explain how checkout routes after payment`
- `/explain CartPage build method`

---

## Output format (use these headings in order)

### Purpose

One short paragraph: why this code exists in the product context (**LegacyApp** — Legacy GetX app).

### Public API

Surface area: public classes/methods, constructors, and what callers are expected to pass. Note codegen involvement when **none** is not `none`.

### Call flow

Ordered steps from entry point (e.g. widget `build`, route handler, Bloc `on<Event>`, Riverpod `build`, GetX controller lifecycle) through collaborators. Tie navigation to **GetX Navigation** where relevant.

### State and side effects

How state is held and updated for **GetX** (getx). Mention async work, listeners, and disposal. Reference **- View (Widget) MUST NOT contain business logic
- Controller MUST NOT import Flutter widgets directly
- Model MUST be plain Dart, no framework dependencies** if layering is unclear.

### I/O and backends

Network, local storage, or platform channels touching **REST API** (and **JWT / REST Auth** where auth applies: jwt_rest). Do **not** invent API shapes not visible in the repo.

### Failure modes

What can go wrong: null paths, error states, race conditions, missing permissions on ios, android, auth edge cases.

### Suggested tests

Ideas aligned with **unit_widget** and **patrol**; for **GetX**, prefer patterns like:

```
Get.put(MyController()); final ctrl = Get.find<MyController>(); expect(ctrl.value, expected);
```

### Unknowns — questions for you

If behavior depends on runtime config, native projects, remote API contracts, or secrets not in tree: **stop** and list **specific** questions. Do not fabricate facts.

---

## References

- **Project brief:** `project-brief.yaml` — feature modules: auth, dashboard; special features: .
- **Scale:** medium; i18n locales: en (when explaining localization).
- **Design:** none; Figma URL: .
- **API docs format:** openapi (path: docs/api.yaml).
- **Related repos (if any):**

_No Git repository URLs listed._ Add entries under `references.repos` in project-brief.yaml when other repos are part of the product context.

- **Local paths (if any):**

_No local paths listed._ Add monorepo packages or sibling folders under `references.local_paths` in project-brief.yaml when relevant.

**Template version:** 1.0.5
