Skip to main content
Prompts Flutter Map SDK Layer Bug Fixer

developer coding template risk: low

Flutter Map SDK Layer Bug Fixer

Instructs the model to act as a senior Flutter engineer and GIS/map expert to explain the map system flow, diagnose bugs in layer loading and property application based on provided…

PROMPT

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?

INPUTS

feature_description REQUIRED

Description of the map feature involving layers and properties

expected_behavior REQUIRED

Description of the expected behavior for the feature

actual_issue REQUIRED

Description of the actual bug or issue observed

code_snippet REQUIRED

The Flutter code snippet with the bug

REQUIRED CONTEXT

  • feature_description
  • expected_behavior
  • actual_issue
  • code_snippet

ROLES & RULES

Role assignments

  • Act as a senior Flutter engineer + GIS/map system expert (ArcGIS-like SDK).
  1. You MUST first explain system clearly before fixing.
  2. Do NOT assume SDK behavior without stating it
  3. Do NOT move logic randomly
  4. Do NOT add conditions blindly
  5. Focus on timing and data flow
  6. Provide the smallest possible change
  7. Do NOT rewrite the system
  8. Provide ONLY the modified code snippet

EXPECTED OUTPUT

Format
markdown
Schema
markdown_sections · 1. Map System Flow (Visual + Layer-Specific), 2. Expected Behavior (Map-Specific), 3. Current Behavior, 4. Mismatch (Critical), 5. Root Cause (Precise), 6. Minimal Fix (STRICT), 7. Why Fix Works, 8. Map-Specific Risks (IMPORTANT), 9. Prevention (Map Architecture)
Constraints
  • STRICT output format
  • Minimal fix only
  • Ask up to 3 questions and STOP if inputs insufficient
  • No over-engineering

SUCCESS CRITERIA

  • Map the bug to a specific flow step.
  • Identify timing issue if present.
  • Provide minimal and scoped fix.
  • Avoid over-engineering.
  • Explain system flow clearly before fixing.
  • Link fix to flow, SDK, and lifecycle.

FAILURE MODES

  • Over-engineering or rewriting the system.
  • Assuming SDK behavior without stating assumptions.
  • Ignoring timing and data flow focus.
  • Providing non-minimal changes.
  • Failing to use strict output format.

CAVEATS

Dependencies
  • Requires ${feature_description}
  • Requires ${expected_behavior}
  • Requires ${actual_issue}
  • Requires ${code_snippet}
Missing context
  • Specific Map SDK name and version (e.g., arcgis_maps_flutter).
  • Example inputs for ${feature_description}, ${expected_behavior}, etc., to illustrate usage.
Ambiguities
  • "Provide a real flow diagram" does not specify format (e.g., text-based ASCII art, Mermaid syntax, or image).

QUALITY

OVERALL
0.93
CLARITY
0.95
SPECIFICITY
0.95
REUSABILITY
0.90
COMPLETENESS
0.95

IMPROVEMENT SUGGESTIONS

  • Clarify diagram format: 'Provide a Mermaid or ASCII flow diagram...'
  • Add 'Verification Steps' section after fix to test the solution.
  • Explicitly state assumed SDK internals if generalizing beyond ArcGIS-like.

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR DEVELOPER