ElevationPoint class and LatLng
W2NJL opened this issue · 5 comments
Hi there,
I'm trying to use this absolutely awesome plugin to show a terrain profile. That part works beautifully, but I'm trying to implement the hoverPoint feature over a line to show where the user is on the terrain profile. When trying to construct the MarkerLayerOptions...
MarkerLayerOptions(markers: [if (hoverPoint is LatLng)Marker(
point: hoverPoint,
width: 8,
height: 8,
builder: (BuildContext context) => Container(
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(8)),
))]),
I get an error about the point argument of HoverPoint (type ElevationPoint) not being assignable to the class LatLng*.
I understand how to construct a LatLng pair in lieu of an ElevationPoint, the problem is that the ElevationHoverNotification notification requires an ElevationPoint.
I fear something with null safety may have affected this? But I just ask if anyone might know of a workaround, as I would love to have this feature.
Anyway, thank you for this wonderful plugin regardless that I will be using in my current app project.
Hi there,
Seems like a bug on the example
project. What's weird is that it works on my own.
I'm working on it, will release soon.
Thanks for your kind words! :-)
@W2NJL can you check #8 and tell me if that fixes your case?
If it doesn't, could you
flutter doctor -v
so I can reproduce your issue? On my side it is working fine :-)
Hello @HugoHeneault ,
Thanks so much for the reply and checking this! So, after making the change you suggested I still am seeing an error. First, here is my flutter doctor -v results:
nicklangan@Nicks-MacBook-Pro wtfda_radioland % flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale en-US)
• Flutter version 2.5.3 at /users/nicklangan/flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (4 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/nicklangan/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.1, Build version 13A1030d
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.61.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 1A2B7605-C320-466C-92D7-51BEB8CED943 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
• No issues found!
And here is the error I currently see:
======== Exception caught by widgets library =======================================================
The following _TypeError was thrown building StreamBuilder<int>(dirty, state: _StreamBuilderBaseState<int, AsyncSnapshot<int>>#216f6):
type 'ElevationPoint' is not a subtype of type 'LatLng'
The relevant error-causing widget was:
FlutterMap FlutterMap:file:///Users/nicklangan/StudioProjects/wtfda_radioland/lib/classes/radioLandPopUp.dart:188:15
When the exception was thrown, this was the stack:
#0 MarkerLayer.build.<anonymous closure> (package:flutter_map/src/layer/marker_layer.dart:131:43)
#1 StreamBuilder.build (package:flutter/src/widgets/async.dart:545:81)
#2 _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:124:48)
#3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4782:27)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4665:15)
#5 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#6 Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#7 StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#8 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#9 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#10 Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#11 StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#12 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#13 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5700:32)
#14 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6356:17)
#15 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#16 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#17 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#18 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#19 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#20 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5700:32)
#21 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6356:17)
#22 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#23 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#24 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#25 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#26 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#27 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#28 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#30 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#31 Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#32 StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#33 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#34 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#35 Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#36 StatelessElement.update (package:flutter/src/widgets/framework.dart:4746:5)
#37 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#38 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#39 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4840:11)
#40 Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#41 StatefulElement.update (package:flutter/src/widgets/framework.dart:4872:5)
#42 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#43 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6202:14)
#44 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#45 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4690:16)
#46 Element.rebuild (package:flutter/src/widgets/framework.dart:4355:5)
#47 ProxyElement.update (package:flutter/src/widgets/framework.dart:5020:5)
#48 Element.updateChild (package:flutter/src/widgets/framework.dart:3412:15)
#49 _LayoutBuilderElement._layout.layoutCallback (package:flutter/src/widgets/layout_builder.dart:137:18)
#50 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2573:19)
#51 _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:154:12)
#52 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1968:59)
#53 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:916:15)
#54 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1968:14)
#55 RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter/src/widgets/layout_builder.dart:228:7)
#56 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:363:5)
#57 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#58 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:56:11)
#59 RenderStack._computeSize (package:flutter/src/rendering/stack.dart:570:43)
#60 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:597:12)
#61 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#62 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:233:12)
#63 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#64 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#65 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1097:7)
#66 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#67 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#68 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1713:7)
#69 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:885:18)
#70 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)
#71 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#72 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#73 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#74 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#75 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#79 _invoke (dart:ui/hooks.dart:166:10)
#80 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#81 _drawFrame (dart:ui/hooks.dart:129:31)
(elided 3 frames from dart:async)
Please let me know if you need anything else from me - I would be happy to provide!!
Nick
Update - I got it to work! This was 100% my fault for messing around with the Flutter Maps package and changing its dependency from LatLng2 to just LatLng. I updated Flutter Maps to the newest version and everything is working great. I am so happy I even have a screen capture of what I put together in action haha:
https://vimeo.com/manage/videos/644001185
Thank you for your time looking into this and keep up the awesome work. This plugin is amazing.
Cool that you got it working :-)
I'll submit the PR anyway as it's cleaner than before.
Have a nice day coding!