lpongetti/flutter_map_marker_cluster

Clicking On Cluster Dot Creates Error.

mac-spinks opened this issue · 2 comments

When zoomed out to where the cluster is showing, if you click on the cluster to zoom in it generates an error. It begins to zoom in, shows only a few of the tiles, and the rest are greyed out. It does show the markers though. While zooming in with fingers it does not generate this error. The error generated:

══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞═════════════════
The following SocketException was thrown resolving an image
codec:
Connection failed (OS Error: Too many open files, errno = 24),
address = a.tile.openstreetmap.org, port = 443

When the exception was thrown, this was the stack:
#0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:719:35)
#1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1877:26)
#2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)
#3 RawSecureSocket.startConnect (dart:io/secure_socket.dart:297:22)
#4 SecureSocket.startConnect (dart:io/secure_socket.dart:77:28)
#5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2482:26)
#6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2924:12)
#7 _HttpClient._getConnection (dart:_http/http_impl.dart:2929:12)
#8 _HttpClient._openUrl (dart:_http/http_impl.dart:2784:12)
#9 _HttpClient.getUrl (dart:_http/http_impl.dart:2627:48)
#10 FMNetworkNoRetryImageProvider._loadAsync (package:flutter_map/src/layer/tile_layer/tile_provider/network_no_retry_image_provider.dart:70:58)
#11 FMNetworkNoRetryImageProvider.loadBuffer (package:flutter_map/src/layer/tile_layer/tile_provider/network_no_retry_image_provider.dart:40:14)
#12 ImageProvider.resolveStreamForKey. (package:flutter/src/painting/image_provider.dart:536:20)
#13 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:382:22)
#14 ImageProvider.resolveStreamForKey (package:flutter/src/painting/image_provider.dart:526:81)
#15 ImageProvider.resolve. (package:flutter/src/painting/image_provider.dart:374:9)
#16 ImageProvider._createErrorHandlerAndKey. (package:flutter/src/painting/image_provider.dart:488:24)
#17 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:41:39)
#18 ImageProvider._createErrorHandlerAndKey (package:flutter/src/painting/image_provider.dart:485:9)
#19 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:371:5)
#20 TileImage.load (package:flutter_map/src/layer/tile_layer/tile_image.dart:137:36)
#21 _TileLayerState._loadTiles (package:flutter_map/src/layer/tile_layer/tile_layer.dart:610:12)
#22 _TileLayerState._onTileUpdateEvent (package:flutter_map/src/layer/tile_layer/tile_layer.dart:546:42)
#23 _TileLayerState.didChangeDependencies. (package:flutter_map/src/layer/tile_layer/tile_layer.dart:353:30)
#31 TileUpdateTransformers.ignoreTapEvents. (package:flutter_map/src/layer/tile_layer/tile_update_transformer.dart:17:39)
(elided 34 frames from dart:async)

Image provider: FMNetworkNoRetryImageProvider()
Image key: FMNetworkNoRetryImageProvider()
═════════════════════════════════════════════════════════════════

Code for map:

FlutterMap(
      options: MapOptions(
        center: LatLng((maxLat + minLat) / 2,
            (maxLong + minLong) / 2),
        zoom: 10,
        maxZoom: 18.5,
      ),
      nonRotatedChildren: [
        RichAttributionWidget(
          attributions: [
            TextSourceAttribution(
              'OpenStreetMap contributors',
              onTap: () => launchUrl(Uri.parse('https://openstreetmap.org/copyright')),
            ),
          ],
        ),
      ],
      children: [
        TileLayer(
          urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          subdomains: const ['a', 'b', 'c'],
          userAgentPackageName: 'com.example.map',
        ),
        MarkerClusterLayerWidget(
          options: MarkerClusterLayerOptions(
            maxClusterRadius: 40,
            size: const Size(40, 40),
            anchor: AnchorPos.align(AnchorAlign.center),
            disableClusteringAtZoom: 16,
            popupOptions: PopupOptions(
                popupBuilder: (context, marker) {
                  var appointment = appointments[markers.indexOf(marker)];
                  return Card(
                    child: Row(
                      children: [
                        Column(
                          children: [
                            IconButton(onPressed: (){

                            }, icon: Icon(Icons.arrow_upward)),
                            IconButton(onPressed: (){

                            }, icon: Icon(Icons.arrow_downward)),
                          ],
                        ),
                        Column(
                          children: [
                            Row(
                                mainAxisSize: MainAxisSize.min,
                                children: <Widget>[
                                  Padding(
                                    padding: const EdgeInsets.only(left: 20, right: 10),
                                    child: IconButton(
                                      icon: Icon(Icons.arrow_circle_right_rounded),
                                      color: Colors.yellow,
                                      tooltip: "Go To Appointment Details",
                                      onPressed: () async {

                                      Navigator.of(context, rootNavigator: true).popUntil((route){
                                        return route.settings.name == Constants.dashboardString;
                                      });
                                      Navigator.of(context,
                                          rootNavigator: true)
                                          .push(MaterialPageRoute(
                                          builder: (context) => BlocProvider<
                                              AppointmentCubit>(
                                              create: (context) =>
                                              AppointmentCubit(
                                                  context)
                                                ..init(
                                                    appointment),
                                              child:
                                              AppointmentDetailsScreen()),
                                          settings: RouteSettings(name: Constants.appointmentDetailsString)));
                                    },),
                                  ),
                                  Padding(
                                    padding: const EdgeInsets.all(10),
                                    child: Container(
                                      constraints: const BoxConstraints(minWidth: 100, maxWidth: 200),
                                      child: Column(
                                        crossAxisAlignment: CrossAxisAlignment.start,
                                        mainAxisAlignment: MainAxisAlignment.start,
                                        mainAxisSize: MainAxisSize.min,
                                        children: <Widget>[
                                          Text(
                                            appointment.address.formattedAddressMultiline,
                                            softWrap: true,
                                            style: TextStyle(
                                              fontWeight: FontWeight.w500,
                                              fontSize: 14.0,
                                            ),
                                          ),
                                          const Padding(padding: EdgeInsets.symmetric(vertical: 4.0)),
                                          Text(
                                            'Scheduled for ${appointment.start!.toShort24HourTimeString()}',
                                            style: const TextStyle(fontSize: 12.0),
                                          ),
                                        ],
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                          ],
                        ),
                      ],
                    ),
                  );
                },
                popupState: PopupState()
              
            ),
            fitBoundsOptions: const FitBoundsOptions(
              padding: EdgeInsets.all(50),
              maxZoom: 18.5,
            ),
            markers: markers,
            builder: (context, markers) {
              return Container(
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(20),
                    color: Colors.blue),
                child: Center(
                  child: Text(
                    markers.length.toString(),
                    style: const TextStyle(color: Colors.white),
                  ),
                ),
              );
            },
          ),
        ),
      ],
    );

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.