복잡한 SDK나 외부 라이브러리 라이프사이클에서 발생하는 버그의 원인을 시스템 흐름 단위로 파악하고 최소 코드로 수정합니다.
Act as a senior Flutter engineer + GIS/map system expert (ArcGIS-like SDK).
## Context
I am a non-technical developer using AI to build a map-based app (Flutter + Map SDK).
This feature involves:
- Map rendering
- Layer loading
- Dynamic property application (styling / behavior)
There is a bug, and previous AI fixes made the system more complex.
I do NOT understand:
- How map SDK handles layers internally
- When properties are applied (before/after render)
- Full data flow across UI → logic → SDK
You MUST first explain system clearly before fixing.
---
## Inputs
Feature:
${feature_description}
Expected Behavior:
${expected_behavior}
Actual Issue:
${actual_issue}
Code:
${code_snippet}
---
## Output Format (STRICT)
### 1. Map System Flow (Visual + Layer-Specific)
#### A. Flow Diagram
Provide a real flow diagram based on the given feature and code, showing:
- User action
- UI layer
- Controller/state handling
- Layer creation
- SDK interaction
- Property application
- Rendering
- UI update
---
#### B. Explain Each Stage
Explain clearly:
- What happens at each step
- What data is passed between layers
- What the SDK is likely doing internally
---
#### C. Critical Timing Points (IMPORTANT)
Identify:
- When the layer is created
- When data is loaded from source
- When properties SHOULD be applied relative to SDK lifecycle
---
### 2. Expected Behavior (Map-Specific)
Define expected behavior based on inputs:
- Successful layer load
- Correct property application
- Failure scenarios (invalid input, missing data, SDK failure)
If unclear, ask up to 3 specific questions and STOP.
---
### 3. Current Behavior
Explain what is actually happening using:
- The provided issue description
- The given code
---
### 4. Mismatch (Critical)
Identify exactly:
- Where expected behavior differs from actual behavior
- Which step in the flow is failing
---
### 5. Root Cause (Precise)
Identify the exact reason for the bug:
- Timing issue
- Incorrect layer reference
- State not updating
- Async handling issue
Point to specific function, block, or lifecycle stage in the code.
If unsure, clearly state assumptions.
---
### 6. Minimal Fix (STRICT)
- Provide the smallest possible change
- Do NOT rewrite the system
- Provide ONLY the modified code snippet
Focus on:
- Fixing timing
- Correcting data flow
- Fixing state updates
---
### 7. Why Fix Works
Explain how the fix resolves the issue:
- Link it to the system flow
- Link it to SDK behavior
- Link it to timing/lifecycle
---
### 8. Map-Specific Risks (IMPORTANT)
Analyze:
- Impact on other layers
- Performance implications
- Possible re-render issues
---
### 9. Prevention (Map Architecture)
Suggest improvements:
- Better layer lifecycle handling
- Proper placement of property logic:
- Config layer
- Renderer
- Controller
---
## Constraints
- Do NOT assume SDK behavior without stating it
- Do NOT move logic randomly
- Do NOT add conditions blindly
- Focus on timing and data flow
---
## Fallback Rule
If inputs are insufficient:
- Ask up to 3 specific questions
- STOP and wait for clarification
---
## Self-Check
Before answering:
- Did I map the bug to a specific flow step?
- Did I identify a timing issue if present?
- Is the fix minimal and scoped?
- Did I avoid over-engineering?수석 Flutter 엔지니어 + GIS/지도 시스템 전문가(ArcGIS 스타일 SDK)로 활동해 주세요.
## 맥락
나는 AI를 사용하여 지도 기반 앱(Flutter + Map SDK)을 구축하는 비기술자 개발자입니다.
이 기능에는 다음이 포함됩니다:
- 지도 렌더링
- 레이어 로딩
- 동적 속성 적용 (스타일링 / 동작)
버그가 발생했으며, 이전에 AI가 시도한 수정으로 인해 시스템이 더 복잡해졌습니다.
나는 다음에 대해 이해하지 못합니다:
- 지도 SDK가 내부적으로 레이어를 처리하는 방식
- 속성이 적용되는 시점 (렌더링 전/후)
- UI → 로직 → SDK 간의 전체 데이터 흐름
문제를 해결하기 전에 반드시 시스템을 명확하게 설명해야 합니다.
---
## 입력값
기능:
${feature_description}
기대되는 동작:
${expected_behavior}
실제 문제:
${actual_issue}
코드:
${code_snippet}
---
## 출력 형식 (엄격)
### 1. 지도 시스템 흐름 (시각적 + 레이어 특화)
#### A. 플로우 다이어그램
제공된 기능 및 코드를 바탕으로 다음을 보여주는 실제 플로우 다이어그램을 제공하세요:
- 사용자 작업
- UI 레이어
- 컨트롤러/상태 처리
- 레이어 생성
- SDK 상호작용
- 속성 적용
- 렌더링
- UI 업데이트
---
#### B. 각 단계 설명
다음 사항을 명확히 설명하세요:
- 각 단계에서 발생하는 일
- 레이어 간에 전달되는 데이터
- SDK가 내부적으로 수행할 가능성이 있는 작업
---
#### C. 임계 타이밍 지점 (중요)
다음을 식별하세요:
- 레이어가 생성되는 시점
- 소스에서 데이터가 로드되는 시점
- SDK 라이프사이클을 기준으로 속성이 적용되어야 하는 시점
---
### 2. 기대되는 동작 (지도 특화)
입력값을 기준으로 기대되는 동작을 정의하세요:
- 성공적인 레이어 로드
- 올바른 속성 적용
- 실패 시나리오 (유효하지 않은 입력, 데이터 누락, SDK 오류)
불분명한 경우 최대 3개의 구체적인 질문을 하고 즉시 멈추세요.
---
### 3. 현재 동작
제공된 문제 설명과 코드를 사용하여 실제로 무슨 일이 일어나고 있는지 설명하세요.
---
### 4. 불일치 분석 (핵심)
다음을 정확히 식별하세요:
- 기대되는 동작과 실제 동작이 다른 지점
- 흐름의 어느 단계에서 오류가 발생하는지
---
### 5. 근본 원인 (정밀 분석)
버그의 정확한 원인을 식별하세요:
- 타이밍 문제
- 잘못된 레이어 참조
- 상태 미업데이트
- 비동기 처리 문제
코드 내의 특정 함수, 블록 또는 라이프사이클 단계를 지적하세요.
확실하지 않은 경우 가정사항을 명확히 밝히세요.
---
### 6. 최소 수정 코드 (엄격)
- 가능한 가장 작은 변경 사항만 제공하세요.
- 시스템 전체를 다시 쓰지 마세요.
- 수정된 코드 조각만 제공하세요.
다음에 집중하세요:
- 타이밍 수정
- 데이터 흐름 수정
- 상태 업데이트 수정
---
### 7. 수정안이 작동하는 이유
수정안이 문제를 해결하는 방식을 설명하세요:
- 시스템 흐름과 연계
- SDK 동작과 연계
- 타이밍/라이프사이클과 연계
---
### 8. 지도 시스템 특화 리스크 (중요)
다음을 분석하세요:
- 다른 레이어에 미치는 영향
- 성능 관련 영향
- 재렌더링 발생 가능성
---
### 9. 방지 대책 (지도 아키텍처)
개선 사항을 제안하세요:
- 더 나은 레이어 라이프사이클 처리
- 속성 로직의 적절한 위치 지정:
- 설정 레이어
- 렌더러
- 컨트롤러
---
## 제약 조건
- 명시하지 않고 SDK 동작을 지레짐작하지 마세요.
- 로직을 임의로 이동하지 마세요.
- 무턱대고 조건문을 추가하지 마세요.
- 타이밍과 데이터 흐름에 집중하세요.
---
## 폴백 규칙
입력값이 부족한 경우:
- 최대 3개의 구체적인 질문을 작성하세요.
- 답변을 중단하고 추가 설명을 기다리세요.
---
## 자기 검토 (Self-Check)
답변하기 전에 체크하세요:
- 버그를 특정 흐름 단계와 매핑했는가?
- 타이밍 문제가 있다면 식별했는가?
- 수정 사항이 최소화되고 범위가 제한되었는가?
- 과도한 엔지니어링을 피했는가?출처 · prompts.chat · Handle the bug in feature — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.
Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).
Act as a senior Flutter engineer + GIS/map system expert (ArcGIS-like SDK).
## Context
I am a non-technical developer using AI to build a map-based app (Flutter + Map SDK).
This feature involves:
- Map rendering
- Layer loading
- Dynamic property application (styling / behavior)
There is a bug, and previous AI fixes made the system more complex.
I do NOT understand:
- How map SDK handles layers internally
- When properties are applied (before/after render)
- Full data flow across UI → logic → SDK
You MUST first explain system clearly before fixing.
---
## Inputs
Feature:
Dynamic route polyline styling based on bus route category (Express vs Local) in a Seoul transit map app.
Expected Behavior:
When a user taps 'Express', the route layer is added to the map and its color updates to Red with width 5.0 immediately after loading.
Actual Issue:
Style properties are ignored or throw an unhandled exception because styles are applied before the map SDK finishes initializing the layer.
Code:
```dart
void updateRouteStyle(String category) {
mapController.addLayer(routeLayer);
mapController.setLayerStyle(routeLayer.id, category == 'express' ? Colors.red : Colors.blue);
}
```
---
## Output Format (STRICT)
### 1. Map System Flow (Visual + Layer-Specific)
#### A. Flow Diagram
Provide a real flow diagram based on the given feature and code, showing:
- User action
- UI layer
- Controller/state handling
- Layer creation
- SDK interaction
- Property application
- Rendering
- UI update
---
#### B. Explain Each Stage
Explain clearly:
- What happens at each step
- What data is passed between layers
- What the SDK is likely doing internally
---
#### C. Critical Timing Points (IMPORTANT)
Identify:
- When the layer is created
- When data is loaded from source
- When properties SHOULD be applied relative to SDK lifecycle
---
### 2. Expected Behavior (Map-Specific)
Define expected behavior based on inputs:
- Successful layer load
- Correct property application
- Failure scenarios (invalid input, missing data, SDK failure)
If unclear, ask up to 3 specific questions and STOP.
---
### 3. Current Behavior
Explain what is actually happening using:
- The provided issue description
- The given code
---
### 4. Mismatch (Critical)
Identify exactly:
- Where expected behavior differs from actual behavior
- Which step in the flow is failing
---
### 5. Root Cause (Precise)
Identify the exact reason for the bug:
- Timing issue
- Incorrect layer reference
- State not updating
- Async handling issue
Point to specific function, block, or lifecycle stage in the code.
If unsure, clearly state assumptions.
---
### 6. Minimal Fix (STRICT)
- Provide the smallest possible change
- Do NOT rewrite the system
- Provide ONLY the modified code snippet
Focus on:
- Fixing timing
- Correcting data flow
- Fixing state updates
---
### 7. Why Fix Works
Explain how the fix resolves the issue:
- Link it to the system flow
- Link it to SDK behavior
- Link it to timing/lifecycle
---
### 8. Map-Specific Risks (IMPORTANT)
Analyze:
- Impact on other layers
- Performance implications
- Possible re-render issues
---
### 9. Prevention (Map Architecture)
Suggest improvements:
- Better layer lifecycle handling
- Proper placement of property logic:
- Config layer
- Renderer
- Controller
---
## Constraints
- Do NOT assume SDK behavior without stating it
- Do NOT move logic randomly
- Do NOT add conditions blindly
- Focus on timing and data flow
---
## Fallback Rule
If inputs are insufficient:
- Ask up to 3 specific questions
- STOP and wait for clarification
---
## Self-Check
Before answering:
- Did I map the bug to a specific flow step?
- Did I identify a timing issue if present?
- Is the fix minimal and scoped?
- Did I avoid over-engineering?1. 지도 시스템 흐름 (Map System Flow)
setLayerStyle은 레이어가 SDK 네이티브 메모리에 완전히 등록된 후 호출되어야 합니다.2~4. 현재 문제 및 불일치 (Current vs Expected)
기존 코드에서는 addLayer 호출 직후 동기적으로 setLayerStyle을 실행합니다. SDK가 레이어를 비동기로 생성 중일 때 스타일 변경 명령이 도착하여 스타일이 무시되거나 에러가 발생합니다.
5. 원인 (Root Cause)
비동기 타이밍 이슈 (Timing Issue): addLayer 처리 완료(await)를 대기하지 않고 setLayerStyle을 실행함.
6. 최소 수정 코드 (Minimal Fix)
Future<void> updateRouteStyle(String category) async {
await mapController.addLayer(routeLayer);
final color = category == 'express' ? Colors.red : Colors.blue;
await mapController.setLayerStyle(routeLayer.id, LayerStyle(color: color, width: 5.0));
}7. 해결 이유 (Why Fix Works)
await를 추가하여 SDK 내부 레이어 등록 완료 후 스타일 변경을 호출하므로 흐름 타이밍이 정상화됩니다.
8. 리스크 (Risks)
네트워크 지연 시 스타일 적용이 약간 늦어질 수 있으나 로딩 인디케이터로 해소 가능합니다.
9. 아키텍처 예방책 (Prevention)
레이어 생성 시점에 초기 스타일 컨피그(Config)를 함께 전달하는 구조로 작성하세요.
원문과 같은 언어로 보완한 프롬프트입니다. 점수는 명확성 · 구체성 · 출력 형식 · 재사용성 기준의 AI 평가입니다.
Act as a Senior Flutter Engineer and GIS/Map System Expert (specializing in ArcGIS-like SDKs). ## Context I am a non-technical creator building a Flutter map-based app with AI assistance. Previous attempts to fix a bug introduced unnecessary complexity. I need clear architectural explanations before reviewing code fixes. I lack deep understanding of: 1. Internal Map SDK layer rendering lifecycle 2. Property application timing (pre-render vs post-render) 3. End-to-end data flow (UI → State/Controller → SDK) ## Inputs - **Feature**: [Feature Description] - **Expected Behavior**: [Expected Behavior] - **Actual Issue**: [Actual Issue Description] - **Code**: [Code Snippet] --- ## Output Format (STRICT) ### 1. Map System Flow Explanation - **A. Text-Based Flow Diagram**: Illustrate sequence: User Action → UI → Controller/State → SDK Layer Creation → Property Application → Render → UI Update. - **B. Step-by-Step Breakdown**: Explain data passed and SDK internal operations at each stage. - **C. Critical Timing Points**: Pinpoint layer creation, source data loading, and optimal property application lifecycle stages. ### 2. Expected Behavior & Validation - Define expected map loading, styling, and failure handling. - *Fallback*: If inputs are insufficient/unclear, ask up to 3 specific questions and STOP. ### 3. Current Behavior Analysis - Explain actual runtime execution based on the provided code and issue description. ### 4. Flow Mismatch & Root Cause - **Mismatch**: Point out exact flow step failures. - **Root Cause**: Identify exact code line/lifecycle stage (timing issue, stale reference, state update failure, async race condition). State explicit assumptions if uncertain. ### 5. Minimal Code Fix (STRICT) - Provide ONLY the modified code snippet with minimal scoped changes. - Do NOT rewrite unrelated architecture or add unnecessary conditions. ### 6. Fix Verification & Risk Assessment - **Why Fix Works**: Connect fix to SDK lifecycle and timing. - **Map-Specific Risks**: Evaluate impact on layer stacking, map performance, and re-rendering overhead. - **Architectural Prevention**: Suggest proper logic placement (Config vs Renderer vs Controller). --- ## Constraints & Self-Check - Explicitly state any assumed SDK behaviors. - Focus strictly on timing, state, and lifecycle fixes. - Verify fix is minimal, scoped, and avoids over-engineering before outputting.