Fiz um app usando flutter onde quero determinar um trajeto entre dois pontos. Eu até consigo fazer, mas o problema é que a linha que liga os pontos A, B não respeita as ruas...
Eu uso um package, google_map_polyline que pede uma chave de acesso (API_KEY
), mas que sempre que compilo me devolve uma exception
e por isso acho que preciso de uma conta paga para que a chave possa funcionar.
Alguém sabe o porque dessa exceção ou tem alguma solução de como fazer a linha seguir o trajeto das ruas sem esse package ?
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)