Path between 2 points with polylines, google maps route

Asked

Viewed 303 times

0

I made an app using flutter where I want to determine a path between two points. I can do it, but the problem is that the line that connects the points A, B doesn’t respect the streets...

I use a package, google_map_polyline who asks for an access key (API_KEY), but every time I compile it returns a exception and so I think I need a paid bill so the key can work.

Does anyone know why of this exception or has any solution of how to make the line follow the path of the streets without this package ?

inserir a descrição da imagem aqui

Exception:

I/flutter (21333): error!!!!
E/flutter (21333): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'iterator' was called on null.
E/flutter (21333): Receiver: null
E/flutter (21333): Tried calling: iterator
[38;5;244mE/flutter (21333): #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)[39;49m
[38;5;244mE/flutter (21333): #1      new List.from  (dart:core-patch/array_patch.dart:54:19)[39;49m
[38;5;244mE/flutter (21333): #2      new List.of  (dart:core/list.dart:142:65)[39;49m
[38;5;248mE/flutter (21333): #3      Polyline.clone[39;49m
[38;5;248mE/flutter (21333): #4      keyByPolylineId.<anonymous closure>[39;49m
[38;5;244mE/flutter (21333): #5      MappedIterator.moveNext  (dart:_internal/iterable.dart:395:18)[39;49m
[38;5;244mE/flutter (21333): #6      MapMixin.addEntries  (dart:collection/maps.dart:172:23)[39;49m
[38;5;244mE/flutter (21333): #7      new Map.fromEntries  (dart:core/map.dart:187:17)[39;49m
[38;5;248mE/flutter (21333): #8      keyByPolylineId[39;49m
[38;5;248mE/flutter (21333): #9      new PolylineUpdates.from[39;49m
[38;5;248mE/flutter (21333): #10     _GoogleMapState._updatePolylines[39;49m
E/flutter (21333): <asynchronous suspension>
[38;5;248mE/flutter (21333): #11     _GoogleMapState.didUpdateWidget[39;49m
[38;5;244mE/flutter (21333): #12     StatefulElement.update[39;49m
[38;5;244mE/flutter (21333): #13     Element.updateChild[39;49m
[38;5;244mE/flutter (21333): #14     ComponentElement.performRebuild[39;49m
[38;5;244mE/flutter (21333): #15     Element.rebuild[39;49m
[38;5;244mE/flutter (21333): #16     BuildOwner.buildScope[39;49m
[38;5;244mE/flutter (21333): #17     WidgetsBinding.drawFrame[39;49m
[38;5;244mE/flutter (21333): #18     RendererBinding._handlePersistentFrameCallback[39;49m
[38;5;244mE/flutter (21333): #19     SchedulerBinding._invokeFrameCallback[39;49m
[38;5;244mE/flutter (21333): #20     SchedulerBinding.handleDrawFrame[39;49m
[38;5;244mE/flutter (21333): #21     SchedulerBinding._handleDrawFrame[39;49m
[38;5;244mE/flutter (21333): #22     _rootRun  (dart:async/zone.dart:1126:13)[39;49m
[38;5;244mE/flutter (21333): #23     _CustomZone.run  (dart:async/zone.dart:1023:19)[39;49m
[38;5;244mE/flutter (21333): #24     _CustomZone.runGuarded  (dart:async/zone.dart:925:7)[39;49m
[38;5;244mE/flutter (21333): #25     _invoke  (dart:ui/hooks.dart:259:10)[39;49m
[38;5;244mE/flutter (21333): #26     _drawFrame  (dart:ui/hooks.dart:217:3)[39;49m
E/flutter (21333):
Lost connection to device.
Exited (sigterm)
  • I know why this exception! It’s because the interactor is being called but is NULL... Now, if you want a better help, put parts of your font that show how you’re mounting this map and route.

  • Use the Google API that draws the route right, respecting the streets as you want, you need to invest a little money because it is paid.

  • @Matheusribeiro, it’s as I suspected... Anyway, thank you for the information !

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.