For non-technical builders: explains how a Flutter map SDK handles layers and property timing, then fixes the described bug step by step.
Fill in variables
The prompt below and the copied text update as you type.
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 + 地图 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 个具体问题
- **停止**并等待澄清
---
## 自检
在回答之前:
- 我是否将缺陷映射到特定流程步骤?
- 我是否识别了可能存在的时机问题?
- 修复是否最小且范围明确?
- 我是否避免了过度设计?