> For the complete documentation index, see [llms.txt](https://docs.fleaflet.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fleaflet.dev/v3/faqs/map-controller-issues.md).

# Map Controller Issues

{% hint style="success" %}
These issues appear significantly less after v2.1.0, due to the reworking of the `MapController` lifecycle.

If you are experiencing these errors, please consider updating to this version or later.
{% endhint %}

This class of errors is usually caused by mis-configuring `MapController`s (see [Controller](/v3/usage/controller.md)), or using them in complex layouts.&#x20;

If you're having these issues - which can manifest as `LateInitializationError`s and/or `BadState` errors - there are a few things you can try to help out:

* Fully read the [Controller](/v3/usage/controller.md) page, and choose the right implementation/usage for your situation.
* In complex layouts, such as with `PageView`s or `ListView`s, use the [Recommended Options](/v3/usage/options/recommended-options.md#keep-alive-keepalive) property.
* If sharing the map controller, for example through `Provider`, make sure that the shared controller is initialised and destroyed/uninitialised at the same time as the `FlutterMap`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fleaflet.dev/v3/faqs/map-controller-issues.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
