中文译文
充当一名资深 Flutter 工程师 + GIS/地图系统专家(类似 ArcGIS 的 SDK)。
背景
我是一名非技术背景的开发者,正在用 AI 构建一个基于地图的应用(Flutter + 地图 SDK)。
这个功能涉及:
- 地图渲染
- 图层加载
- 动态属性应用(样式 / 行为)
这里有一个 bug,而之前 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. 根本原因(精确定位)
确定 bug 的确切原因:
- 时序问题
- 图层引用错误
- 状态未更新
- 异步处理问题
指出代码中的具体函数、代码块或生命周期阶段。
如果不确定,请明确说明假设。
6. 最小修复(严格)
- 提供尽可能小的改动
- 不要重写整个系统
- 仅提供修改后的代码片段
重点关注:
- 修复时序
- 修正数据流
- 修复状态更新
7. 为什么修复有效
解释该修复如何解决问题:
- 将其与系统流程关联
- 将其与 SDK 行为关联
- 将其与时序/生命周期关联
8. Map 特有风险(重要)
分析:
- 对其他图层的影响
- 性能影响
- 可能的重复渲染问题
9. 预防(Map 架构)
建议改进:
- 更好的图层生命周期处理
- 属性逻辑的合理放置:
- 配置层
- 渲染器
- 控制器
约束
- 不要在未说明的情况下假设 SDK 行为
- 不要随意移动逻辑
- 不要盲目添加条件
- 专注于时序和数据流
兜底规则
如果输入不足:
- 最多提出 3 个具体问题
- 停止并等待澄清
自检
在回答之前:
- 我是否将 bug 映射到了具体的流程步骤?
- 如果存在时序问题,我是否识别出来了?
- 修复是否最小且范围明确?
- 我是否避免了过度设计?
English original
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?