flutter_map_marker_cluster
                                
                                 flutter_map_marker_cluster copied to clipboard
                                
                                    flutter_map_marker_cluster copied to clipboard
                            
                            
                            
                        flutter_map popup generate null provider…
in this code that work with previous flutter_map
flutter_map: ^2.1.1
    flutter_map_location_marker: ^4.1.3
    flutter_map_marker_cluster: 
        git:
            url: https://github.com/aytunch/flutter_map_marker_cluster
FlutterMap(
        mapController: _mapController,
        options: MapOptions(
          center: center,
          zoom: 15,
          maxZoom: 20,
          plugins: [
            MarkerClusterPlugin()
          ],
        ),
        nonRotatedChildren: [
          MarkerClusterLayerWidget(
              options: MarkerClusterLayerOptions(
                  maxClusterRadius: 120,
                  size: const Size(40, 40),
                  anchor: AnchorPos.align(AnchorAlign.center),
                  fitBoundsOptions: const FitBoundsOptions(
                    padding: EdgeInsets.all(50),
                  ),
                  markers: markers,
                  popupOptions: PopupOptions(
                      popupSnap: PopupSnap.markerTop,
                      popupController: _popupController,
                      popupBuilder: (_, marker) {
                        return Container(
                          width: 200,
                          height: 100,
                          child: GestureDetector(
                              child: Center(
                            child: Text(
                              'Text',
                              textAlign: TextAlign.center,
                            ),
                          )),
                        );
                      }),
                  builder: (context, markers) {
                    return FloatingActionButton(
                      heroTag: "location",
                      key: const Key("location"),
                      onPressed: null,
                      child: Text(markers.length.toString()),
                    );
                  },
                ))
              ],
            )
I get this error
======== Exception caught by widgets library =======================================================
The following _CastError was thrown building StreamBuilder<void>(dirty, state: _StreamBuilderBaseState<void, AsyncSnapshot<void>>#916c8):
Null check operator used on a null value
When the exception was thrown, this was the stack: 
#0      _MarkerClusterLayerState._buildLayers (package:flutter_map_marker_cluster/src/marker_cluster_layer.dart:510:63)
#1      _MarkerClusterLayerState.build.<anonymous closure> (package:flutter_map_marker_cluster/src/marker_cluster_layer.dart:152:21)
#2      StreamBuilder.build (package:flutter/src/widgets/async.dart:442:81)
#3      _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:124:48)
#4      StatefulElement.build (package:flutter/src/widgets/framework.dart:4919:27)
#5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4806:15)
In package:flutter_map_marker_cluster/src/marker_cluster_layer.dart:510
The problem's cause is in PopupState.maybeOf(context, listen: false)!
because
static PopupState? maybeOf(BuildContext context, {bool listen = true}) {
    return Provider.of<PopupState?>(context, listen: listen);
  }
returns null.
What can I do to have a value…
I fixed the problem by with a PopupScope() that surrounds FlutterMap()
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.