fleaflet / flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.

Home Page:https://pub.dev/packages/flutter_map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG (v7)] Dotted polyline throws exception: `Bad state: No element`

josxha opened this issue · comments

What is the bug?

While moving around on the polyline example page an exception gets thrown in the console. I'm using a pr branch in the video but this behaviour happens as well on master.

Aufzeichnung.2024-05-06.165323.mp4
======== Exception caught by rendering library =====================================================
The following StateError was thrown during paint():
Bad state: No element

The relevant error-causing widget was: 
  CustomPaint CustomPaint:file:///C:/.../flutter_map/lib/src/layer/polyline_layer/polyline_layer.dart:146:14
When the exception was thrown, this was the stack: 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3       throw_
dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 356:5                 last]
packages/flutter_map/src/layer/misc/line_patterns/pixel_hiker.dart 55:28          getAllVisibleDots
packages/flutter_map/src/layer/polyline_layer/painter.dart 226:39                 paint
packages/flutter/src/rendering/custom_paint.dart 588:12                           [_paintWithPainter]
packages/flutter/src/rendering/custom_paint.dart 630:7                            paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/proxy_box.dart 2549:17                             paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/shifted_box.dart 74:14                             paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/box.dart 2882:14                                   defaultPaint
packages/flutter/src/rendering/stack.dart 641:5                                   paintStack
packages/flutter/src/rendering/stack.dart 657:7                                   paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 549:83                                 <fn>
packages/flutter/src/painting/clip.dart 25:5                                      [_clipAndPaint]
packages/flutter/src/painting/clip.dart 53:5                                      clipRectAndPaint
packages/flutter/src/rendering/object.dart 549:7                                  pushClipRect
packages/flutter/src/rendering/proxy_box.dart 1538:24                             paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/widgets/layout_builder.dart 356:14                           paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 250:12                                 paintChild
packages/flutter/src/rendering/proxy_box.dart 130:12                              paint
packages/flutter/src/rendering/object.dart 3237:7                                 [_paintWithContext]
packages/flutter/src/rendering/object.dart 166:10                                 _repaintCompositedChild
packages/flutter/src/rendering/object.dart 109:5                                  repaintCompositedChild
packages/flutter/src/rendering/object.dart 1182:31                                flushPaint
packages/flutter/src/rendering/object.dart 1192:14                                flushPaint
packages/flutter/src/rendering/binding.dart 584:5                                 drawFrame
packages/flutter/src/widgets/binding.dart 991:13                                  drawFrame
packages/flutter/src/rendering/binding.dart 448:5                                 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1386:7                                [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1311:9                                handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1169:5                                [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1346:5                                invoke
lib/_engine/engine/platform_dispatcher.dart 260:5                                 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 185:36                                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 550:37  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 555:39  dcall
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#8fcfd
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=1029.0, h=753.0)
...  size: Size(1029.0, 753.0)
...  painter: _PolylinePainter<({String subtitle, String title})>#32d95()
...  preferredSize: Size(1029.0, 753.0)
RenderObject: RenderCustomPaint#8fcfd
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=1029.0, h=753.0)
  size: Size(1029.0, 753.0)
  painter: _PolylinePainter<({String subtitle, String title})>#32d95()
  preferredSize: Size(1029.0, 753.0)

How can we reproduce it?

  1. launch the example app (I used web as platform)
  2. open the polyline page
  3. move the dotted polyline in and out of the viewable area

Do you have a potential solution?

No response

Platforms

probably all

Severity

Minimum: Allows normal functioning

@josxha Sorry about that, it's a side effect. As you can see on your video, the problem occurs when eventually there are no visible dots.
I'm about to fix and PR.