GithubHelp home page GithubHelp logo

igaurab / user_location_plugin Goto Github PK

View Code? Open in Web Editor NEW
47.0 47.0 75.0 19.81 MB

A plugin for FlutterMap to show user location and handle location permissions.

License: MIT License

Objective-C 1.64% Dart 70.04% Kotlin 9.06% Swift 5.28% Ruby 13.98%

user_location_plugin's People

Contributors

amias-samir avatar binabh avatar boris612 avatar donwasyl avatar hari01584 avatar ivansapr avatar javi11 avatar joharei avatar kk90 avatar konishon avatar m-oehme avatar mrkajetanp avatar murraypurves avatar qbit23 avatar sbu-wbt avatar sjoerd0301 avatar snap10 avatar tlserver avatar xennis avatar xni06 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

user_location_plugin's Issues

Plugin keeps the location service on forever

Describe the bug
If you are using this plugin the location service will be always on even if the app is running in the background. When you are using Google Maps, the location example, ... you will notice all of them turn the location service off when it's not used. But due to

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
here the location service is kept on ... always.

To Reproduce
Steps to reproduce the behavior:

  1. Run the example app
  2. You will see the little location icon in the status bar, i.e. the app is accessing the location service.
  3. Move the app to the background. The location service will be kept on. You still see the location icon in the status bar.

Expected behavior

The location service is not kept on forever. Like the Google Maps app, the location example, etc. it's off once the app goes into the background.

AnimationControllers dispose exception

Describe the bug

I'm very new in Dart and Flutter so I hope what I will describe will be helpful.
First, here is the trace:

Exception has occurred.
FlutterError (_MapsPluginLayerState#ace76(tickers: tracking 3 tickers) was disposed with an active Ticker.
_MapsPluginLayerState created a Ticker via its TickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. All Tickers must be disposed before calling super.dispose().
Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak.
The offending ticker was:
  _WidgetTicker(created by _MapsPluginLayerState#ace76(tickers: tracking 0 tickers))
  The stack trace when the _WidgetTicker was actually created was:
  #0      new Ticker.<anonymous closure> (package:flutter/src/scheduler/ticker.dart:69:40)
  #1      new Ticker (package:flutter/src/scheduler/ticker.dart:71:6)
  #2      new _WidgetTicker (package:flutter/src/widgets/ticker_provider.dart:273:80)
  #3      TickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:204:34)
  #4      new AnimationController (package:flutter/src/animation/animation_controller.dart:249:21)
  #5      _MapsPluginLayerState.animatedMapMove (package:user_location/src/user_location_layer.dart:328:22)
  #6      _MapsPluginLayerState._moveMapToCurrentLocation (package:user_location/src/user_location_layer.dart:219:7)
  #7      _MapsPluginLayerState._subscribeToLocationChanges.<anonymous closure>.<anonymous closure> (package:user_location/src/user_location_layer.dart:194:13)
  #8      State.setState (package:flutter/src/widgets/framework.dart:1240:30)
  #9      _MapsPluginLayerState.setState (package:user_location/src/user_location_layer.dart:67:13)
  #10     _MapsPluginLayerState._subscribeToLocationChanges.<anonymous closure> (package:user_location/src/user_location_layer.dart:129:9)
  (elided 25 frames from dart:async))

To Reproduce
Steps to reproduce the behavior:
Switching back and forth on different views before the map animation finishes cause the crash.

Desktop (please complete the following information):

  • Occurred on: Emulator iPhone SE 2nd generation
  • OS: Catalina
  • Version 10.15.4

Direction is inverted

Hi, thanks for this great plugin :).

I have a problem at least on a Huawei p30 I don't know if is the phone or if it's the plugin but the direction is inverted on the map. A part of that the speed is not real cause the -2

angle: ((_direction ?? 0) *

If I modify this line by:

(((_direction * -1) ?? 0) * (math.pi / 180) * -1) + 180,

All is working as expected.

Is this a real issue or I have something wrong configured?

thanks ;)

Add 'onLocationUpdate' parameter

Inside the UserLocationOptions class, add a new onLocationUpdate, which would be called once user's location has changed.

This example here would print the location every time it changes.

UserLocationOptions(
  context: context,
  ...
  onLocationUpdate: (LatLng pos) => print(pos),
)

The method 'cancel' was called on null.

Upon initial launch, and failing to grant location permissions, when navigating back, a NoSuchMethodError is thrown as a result of trying to close a stream that does not yet exist.

I/flutter ( 8256): The following NoSuchMethodError was thrown while finalizing the widget tree:
I/flutter ( 8256): The method 'cancel' was called on null.
I/flutter ( 8256): Receiver: null
I/flutter ( 8256): Tried calling: cancel()

Show heading of user location marker

Is your feature request related to a problem? Please describe.
The heading of the device is not shown on user location marker

Describe the solution you'd like
Show the heading in user location marker, something similar to google maps might be good place to start

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
I am using this library and implemented routing, So, it would be nice to know where the user is heading.
Making use of simple_flutter_compass might be a good place to start
or compass_in_android

Location service crashes the app

Describe the bug
When the location service is turned off, you get prompted with a rationale for requesting permission (Android only), the Google's location service. If you click "No Thanks" you will get prompted again the same alert until the application finally crashes. Clicking "Ok" works fine, and enables locations service.
You can see the issue in the example.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Settings -> Location
  2. Toggle the Location off
  3. Return to the app
  4. See error

Expected behavior
Clicking on "No Thanks" doesn't prompt the alert again.

Smartphone (please complete the following information):

  • Device: ZTE Blade A512/SM J500F
  • OS: Android
  • Version 6.0.1/5.1.1

Edit: I think it was this commit : 35ba3dab64f5620beb671a89422f0323dee8cc96

Memory leak _MapsPluginLayerState line46

E/flutter (20257): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
E/flutter (20257): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
E/flutter (20257): #0      State.setState.<anonymous closure> 
package:flutter/…/widgets/framework.dart:1205
E/flutter (20257): #1      State.setState 
package:flutter/…/widgets/framework.dart:1240
E/flutter (20257): #2      _MapsPluginLayerState.initState.<anonymous closure> 
package:user_location/src/user_location_layer.dart:46
E/flutter (20257): #3      _RootZone.runUnaryGuarded  (dart:async/zone.dart:1316:10)
E/flutter (20257): #4      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)
E/flutter (20257): #5      _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:266:7)
E/flutter (20257): #6      _SyncStreamControllerDispatch._sendData  (dart:async/stream_controller.dart:773:19)
E/flutter (20257): #7      _StreamController._add  (dart:async/stream_controller.dart:649:7)
E/flutter (20257): #8      _StreamController.add  (dart:async/stream_controller.dart:595:5)
E/flutter (20257): #9      _rootRunUnary  (dart:async/zone.dart:1138:13)
E/flutter (20257): #10     _RootZone.runUnaryGuarded  (dart:async/zone.dart:1319:7)
E/flutter (20257): #11     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:339:11)
E/flutter (20257): #12     _DelayedData.perform  (dart:async/stream_impl.dart:594:14)
E/flutter (20257): #13     _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:710:11)
E/flutter (20257): #14     _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:670:7)
E/flutter (20257): #15     _rootRun  (dart:async/zone.dart:1122:38)
E/flutter (20257): #16     _CustomZone.run  (dart:async/zone.dart:1023:19)
E/flutter (20257): #17     _CustomZone.runGuarded  (dart:async/zone.dart:925:7)
E/flutter (20257): #18     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:965:23)
E/flutter (20257): #19     _rootRun  (dart:async/zone.dart:1126:13)
E/flutter (20257): #20     _CustomZone.run  (dart:async/zone.dart:1023:19)
E/flutter (20257): #21     _CustomZone.runGuarded  (dart:async/zone.dart:925:7)
E/flutter (20257): #22     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:965:23)
E/flutter (20257): #23     _microtaskLoop  (dart:async/schedule_microtask.dart:43:21)
E/flutter (20257): #24     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:52:5)

Add 'tolerance' parameter

This new parameter would establish the limit when user's location should change.

If the change is less than tolerance, location and/or map shouldn't change.

UserLocationOptions(
  context: context,
  ...
  tolerance: 0.00001,
)

Markers doesn't render properly

I'm trying to render a list of markers, generated by data inside a Provider model.

FlutterMap(
  mapController: mapController,
  options: MapOptions(
    zoom: 17,
    minZoom: 5,
    maxZoom: 19,
    plugins: [
      UserLocationPlugin(),
    ],
  ),
  layers: [
    TileLayerOptions(
      urlTemplate: model.mapUrl,
      backgroundColor: Theme.of(context).canvasColor,
    ),
    MarkerLayerOptions(
      markers: [
        for (Museum museum in model.items)
          MapPin(
            title: museum.name,
            subtitle: museum.city,
            id: museum.id,
            location: museum.location,
          )
      ],
    ),
    UserLocationOptions(
      context: context,
      mapController: mapController,
      markers: ???,
    ),
  ],
)

Also, should I add the same markers inside the UserLocationOptions object? Documentation doesn't tell it clearly, since it's using an empty list :/

The MapPin object derives from the Marker class, there were no problem rendering them before implementing this package into the project.

Location marker disappears

Describe the bug
Location marker disappears for a moment every time markers change

To Reproduce
Steps to reproduce the behavior:

  1. Use the example project
  2. Make the markers list change, f.ex. by clicking on a button

Expected behavior
The location marker should stay where it is without disappearing

Actual behavior
The location marker disappears for a moment before coming back

No material widget found on floating action button for current location

Describe the bug
No Material Widget found on FloatingActionButton

To Reproduce
Steps to reproduce the behavior:

  1. Run the app with default scaffold with plugin

Expected behavior
Default provided Floating action button should be visible

Screenshots
Screenshot_20200523-104240

Smartphone (please complete the following information):

  • Device: OnPlus7T
  • OS: Android 10

Additional context

/// **Map code used**

class DummyHolder extends StatelessWidget {
  MapController mapController = MapController();
  UserLocationOptions userLocationOptions;

  List<Marker> markers = [
    Marker(
      width: 24.0,
      height: 24.0,
      point: LatLng(51.5, -0.09),
      builder: (ctx) => Container(
        child: FlutterLogo(),
      ),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    userLocationOptions = UserLocationOptions(
      context: context,
      mapController: mapController,
      markers: markers,
      showMoveToCurrentLocationFloatingActionButton: true,
    );
    return FlutterMap(
      options: MapOptions(
        center: LatLng(51.5, -0.09),
        zoom: 13.0,
        plugins: [
          UserLocationPlugin(),
        ],
      ),
      layers: [
        TileLayerOptions(
          urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
          subdomains: ['a', 'b', 'c'],
        ),
        MarkerLayerOptions(markers: markers),
        userLocationOptions,
      ],
      mapController: mapController,
    );
  }
}


/// **Debug stacktrace**

Launching lib/main.dart on HD1901 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
Debug service listening on ws://127.0.0.1:45911/byZRu8pWbUU=/ws
Syncing files to device HD1901...
I/flutter (12856): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (12856): The following assertion was thrown building InkWell(gestures: [tap], clipped to BoxShape.rectangle,
I/flutter (12856): dirty, state: _InkResponseState<InkResponse>#83f44):
I/flutter (12856): No Material widget found.
I/flutter (12856): InkWell widgets require a Material widget ancestor.
I/flutter (12856): In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
I/flutter (12856): material library, that material is represented by the Material widget. It is the Material widget
I/flutter (12856): that renders ink splashes, for instance. Because of this, many material library widgets require that
I/flutter (12856): there be a Material widget in the tree above them.
I/flutter (12856): To introduce a Material widget, you can either directly include one, or use a widget that contains
I/flutter (12856): Material itself, such as a Card, Dialog, Drawer, or Scaffold.
I/flutter (12856): The specific widget that could not find a Material ancestor was:
I/flutter (12856):   InkWell
I/flutter (12856): The ancestors of this widget were:
I/flutter (12856):   ...
I/flutter (12856):   Positioned
I/flutter (12856):   MapsPluginLayer
I/flutter (12856):   Stack
I/flutter (12856):   _PointerListener
I/flutter (12856):   Listener
I/flutter (12856):   ...
I/flutter (12856): 
I/flutter (12856): The relevant error-causing widget was:
I/flutter (12856):   InkWell
I/flutter (12856):   file:///home/stevenson/.pub-cache/hosted/pub.dartlang.org/user_location-0.1.3/lib/src/user_location_layer.dart:258:20
I/flutter (12856): 
I/flutter (12856): When the exception was thrown, this was the stack:
I/flutter (12856): #0      debugCheckHasMaterial.<anonymous closure> (package:flutter/src/material/debug.dart:28:7)
I/flutter (12856): #1      debugCheckHasMaterial (package:flutter/src/material/debug.dart:50:4)
I/flutter (12856): #2      InkResponse.debugCheckContext (package:flutter/src/material/ink_well.dart:520:12)
I/flutter (12856): #3      _InkResponseState.build (package:flutter/src/material/ink_well.dart:843:19)
I/flutter (12856): #4      StatefulElement.build (package:flutter/src/widgets/framework.dart:4619:28)
I/flutter (12856): #5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4502:15)
I/flutter (12856): #6      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
I/flutter (12856): #7      Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
I/flutter (12856): #8      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
I/flutter (12856): #9      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4666:11)
I/flutter (12856): #10     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
I/flutter (12856): ...     Normal element mounting (15 frames)
I/flutter (12856): #25     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
I/flutter (12856): #26     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
I/flutter (12856): ...     Normal element mounting (35 frames)
I/flutter (12856): #61     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
I/flutter (12856): #62     Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
I/flutter (12856): #63     _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:116:18)
I/flutter (12856): #64     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19)
I/flutter (12856): #65     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:96:11)
I/flutter (12856): #66     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1866:58)
I/flutter (12856): #67     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15)
I/flutter (12856): #68     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1866:13)
I/flutter (12856): #69     RenderConstrainedLayoutBuilder.layoutAndBuildChild (package:flutter/src/widgets/layout_builder.dart:174:5)
I/flutter (12856): #70     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:244:5)
I/flutter (12856): #71     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #72     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #73     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #74     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #75     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #76     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #77     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #78     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #79     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #80     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #81     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #82     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #83     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #84     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #85     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #86     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #87     RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3225:13)
I/flutter (12856): #88     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #89     _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:700:15)
I/flutter (12856): #90     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #91     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #92     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #93     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #94     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #95     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #96     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #97     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #98     RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #99     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #100    RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #101    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter (12856): #102    RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (12856): #103    RenderView.performLayout (package:flutter/src/rendering/view.dart:167:13)
I/flutter (12856): #104    RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7)
I/flutter (12856): #105    PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
I/flutter (12856): #106    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
I/flutter (12856): #107    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:13)
I/flutter (12856): #108    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
I/flutter (12856): #109    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
I/flutter (12856): #110    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
I/flutter (12856): #111    SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:861:7)
I/flutter (12856): (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
I/flutter (12856): 
I/flutter (12856): ════════════════════════════════════════════════════════════════════════════════════════════════════
E/SensorManager(12856): registerListenerImpl sensorName:Rotation Vector  Non-wakeup,isWakeUpSensor:false,callingApp: com.tripspal,callingPid:12856,callingUid:10252
I/flutter (12856): Another exception was thrown: No Material widget found.
I/flutter (12856): Another exception was thrown: No Material widget found.
I/chatty  (12856): uid=10252(com.tripspal) 1.ui identical 1 line
I/flutter (12856): Another exception was thrown: No Material widget found.
I/flutter (12856): Another exception was thrown: No Material widget found.
I/flutter (12856): Another exception was thrown: No Material widget found.
I/flutter (12856): Another exception was thrown: No Material widget found.

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building InkWell(gestures: [tap], clipped to BoxShape.rectangle, dirty, state: _InkResponseState<InkResponse>#83f44):
No Material widget found.

InkWell widgets require a Material widget ancestor.
In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's material library, that material is represented by the Material widget. It is the Material widget that renders ink splashes, for instance. Because of this, many material library widgets require that there be a Material widget in the tree above them.

To introduce a Material widget, you can either directly include one, or use a widget that contains Material itself, such as a Card, Dialog, Drawer, or Scaffold.

The specific widget that could not find a Material ancestor was: InkWell
  gestures: tap
  clipped to BoxShape.rectangle
  dirty
  state: _InkResponseState<InkResponse>#83f44
The ancestors of this widget were: 
  : Positioned
    right: 20.0
    bottom: 20.0
    width: 40.0
    height: 40.0
  : MapsPluginLayer
    dependencies: [_EffectiveTickerMode]
    state: _MapsPluginLayerState#87adb
  : Stack
    alignment: AlignmentDirectional.topStart
    fit: loose
    overflow: clip
    dependencies: [Directionality]
    renderObject: RenderStack#458b4
  : GestureDetector
    startBehavior: start
  : PositionedTapDetector
    state: _TapPositionDetectorState#24fb0
  : LayoutBuilder
    renderObject: _RenderLayoutBuilder#abd0b
  : FlutterMap
    dependencies: [_EffectiveTickerMode]
    state: FlutterMapState#23a72(tickers: tracking 2 tickers)
  : DummyHolder
  : MaterialApp
    state: _MaterialAppState#0515c
  : MyApp
  ...
The relevant error-causing widget was: 
  InkWell file:///home/stevenson/.pub-cache/hosted/pub.dartlang.org/user_location-0.1.3/lib/src/user_location_layer.dart:258:20
When the exception was thrown, this was the stack: 
#0      debugCheckHasMaterial.<anonymous closure> (package:flutter/src/material/debug.dart:28:7)
#1      debugCheckHasMaterial (package:flutter/src/material/debug.dart:50:4)
#2      InkResponse.debugCheckContext (package:flutter/src/material/ink_well.dart:520:12)
#3      _InkResponseState.build (package:flutter/src/material/ink_well.dart:843:19)
#4      StatefulElement.build (package:flutter/src/widgets/framework.dart:4619:28)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

Provide a way to move camera to the current location of the user

After the pull request #6 the user will be able to move the map freely, and the mapController will not redirect the user to their current location automatically. So, if the updateMapLocationOnPositionChange is set to false we must provide a way for the user to navigate to their current location.

I purpose of adding a flag called showMoveToCurrentLocationFloatingActionButton [which by default is true] that will display a button, which will redirect the user to their current location. The user shall also be able to provide their own button widget via moveToCurrentLocationFloatingActionButton optional parameter.

Version conflicts with flutter_map

Because user_location >=0.1.0 depends on flutter_map ^0.8.2 and community_base depends on flutter_map ^0.9.0, user_location >=0.1.0 is forbidden.

So, because xxx depends on user_location ^0.1.3, version solving failed.
pub get failed (1; So, because community_base depends on user_location ^0.1.3, version solving failed.)

Please update version. Thanks so much. :)

APP crashed on startup with Android 29 API [Android X]

Describe the bug
Your plugin work fine on ios, but when i tried it with my existing app that target 29 api. It crashed on startup on android 10, while work fine on below android api 28

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...' set android api to 29
  2. Click on '....' test on android 10
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Android
  • Browser Safari
  • Version

Smartphone (please complete the following information):

  • Device: Android SDK built for x86 (mobile)
  • OS: Android API level 29
  • Browser Safari
  • Version

Additional context
Add any other context about the problem here.

NoSuchMethodError in flutter testing on dispose

When I use the location plugin in my app, all tests fail with an NoSuchMethodError / Null Pointer Error.

The following NoSuchMethodError was thrown while finalizing the widget tree:
The method 'cancel' was called on null.
Receiver: null
Tried calling: cancel()

When the exception was thrown, this was the stack:
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1      _MapsPluginLayerState.dispose (package:user_location/src/user_location_layer.dart:55:42)
#2      StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4435:12)
#3      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1748:13)
[...]

Apparently the _onLocationChangedStreamSubscription listener is never initialized but waiting in the user_location_layer.dart::101 indefinitely for the location permission request.

When disposed in line user_location_layer.dart:55:42 the cancel operation is called, without checking if the subscription ever succeeded.

To Reproduce
Steps to reproduce the behavior:

  1. Implement location plugin in flutter project widget with flutter_map
  2. Write test that starts the widget
  3. Run "flutter test"

Expected behavior
No error, even without location permissions response.

Environment:

  • OS: Ubuntu 18.04
  • user_location Version: 0.1.2
  • flutter_map Version: 0.8.2
  • Flutter Version: 1.12.13
  • Dart Version: 2.7.0

Additional context
The tests are not about testing the plugins functionality or integration. The error appears already from instantiating the widget, without further interaction with the plugin.

Callback for loose location

My problem is to know when the gps signal is loosed and inform to the user
I would like to display a message to the user when his position can be updated because the gps signal is loosed. I'm trying with different workarounds but they are not working well

Possible solution
I would like a callback in UserLocationOptions to manage that.

Thanks a lot in advance

Zoom to current location is not smooth

Describe the bug
On pressing zoom to current location widget, the camera jumps to current location

To Reproduce
Steps to reproduce the behavior:

  1. Load map
  2. Tap on zoom to currect location widget

Expected behavior
The camera should smoothly animate to current user location

Desktop (please complete the following information):
N.A

Smartphone (please complete the following information):

  • Andorid Emulator

Additional context
N.A.

version conflict?

Hello,
I get some proj4dart related error if not using flutter_map: ^0.9.0.
But now it seems that user_location cannot use that version.

Because user_location ^0.0.7 depends on flutter_map ^0.8.0 and user_location <0.0.7 depends on flutter_map ^0.7.0+2, user_location <0.1.0 requires flutter_map ^0.7.0+2 or ^0.8.0.
And because user_location >=0.1.0 depends on flutter_map ^0.8.2, every version of user_location requires flutter_map ^0.7.0+2 or >=0.8.0 <0.9.0.
So, because loyda_suomi depends on both flutter_map ^0.9.0 and user_location any, version solving failed.

In pubspec.yaml:

flutter_map: ^0.9.0
proj4dart: any 
user_location: any

I did not proceed to change files gradle.properties and build.gradle (in intructions it is not clear which one of the build.gradle)

terveisin, Markus

Add 'updateMapOnStart' parameter

This optional parameter would update map's center always the first time it runs.

This option doesn't have much sense if the updateMapLocationOnPositionChange parameter is set to true, because the map will be always updated. It makes more sense once that other parameters is set to false. The map would start with the user front and center, but it wouldn't update map's center every time it moves.

UserLocationOptions(
  context: context,
  ...
  updateMapOnStart: true,
  updateMapLocationOnPositionChange: false,
)

markerlocationStream needs to be removed in readme

Describe the bug
#15 removes markerlocationStream in favour of onLocationChange.
However, readme still has instructions to make use of markerlocationStream

To Reproduce
Not needed

Expected behavior
Readme should should atleast remove markerlocationStream and if possible add usage of onLocationChange

Screenshots
Not needed

Desktop (please complete the following information):
Not needed

Smartphone (please complete the following information):
Not needed

Additional context
Not needed

[ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception: NoSuchMethodError: The getter 'zoom' was called on null.

Describe the bug
I have a button to toggle the user's location on and off. I get the following error when I try to toggle on the users' location.
Everything works fine till I toggle the users' location

[ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception: NoSuchMethodError: The getter 'zoom' was called on null.

This is the stack trace
Receiver: null
E/flutter (12323): Tried calling: zoom
E/flutter (12323): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
E/flutter (12323): #1 MapControllerImpl.zoom (package:flutter_map/src/map/map.dart:50:29)
E/flutter (12323): #2 _MapsPluginLayerState.forceMapUpdate (package:user_location/src/user_location_layer.dart:363:45)
E/flutter (12323): #3 _MapsPluginLayerState._handleCompassDirection. (package:user_location/src/user_location_layer.dart:255:9)
E/flutter (12323): #4 _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12323): #5 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12323): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12323): #7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12323): #8 _DelayedData.perform (dart:async/stream_impl.dart:611:14)
E/flutter (12323): #9 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
E/flutter (12323): #10 _PendingEvents.schedule. (dart:async/stream_impl.dart:687:7)
E/flutter (12323): #11 _rootRun (dart:async/zone.dart:1182:47)
E/flutter (12323): #12 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (12323): #13 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (12323): #14 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
E/flutter (12323): #15 _rootRun (dart:async/zone.dart:1190:13)
E/flutter (12323): #16 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (12323): #17 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (12323): #18 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)
E/flutter (12323): #19 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (12323): #20 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

To Reproduce
Here is my flutter_map widget

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
import 'package:smart_paddock/utils/string_utils.dart';
import 'package:smart_paddock/utils/style_utils.dart';
import 'package:user_location/user_location.dart';

Widget map(List<Marker> markers, List<LatLng> boundary, bool userLocationEnabled,
          LatLng userLocation, BuildContext context) {
  MapOptions mapOptions;
  MapController mapController = MapController();

  // if we have user location enables, create and instance of the user location. <- added to layers in towards the end of this file
  // or if we only have a single tag selected, center the map on the tag
  // else, bound the map to the property boundary
  UserLocationOptions userLocationOptions;
  if(userLocationEnabled){
    userLocationOptions = UserLocationOptions(
      context: context,
      mapController: mapController,
      markers: markers,
      showMoveToCurrentLocationFloatingActionButton: false
    );
    mapOptions = MapOptions(
      plugins: [
        UserLocationPlugin(),
      ],
      center: markers.first.point,
      zoom: 17
    );
  }else if(markers.length == 1){
    mapOptions = MapOptions(
        center: markers.first.point,
        zoom: 17
    );
  }
  else{
    mapOptions =  MapOptions(
      bounds: LatLngBounds.fromPoints(boundary),
      boundsOptions: FitBoundsOptions(
          padding: EdgeInsets.only(top: 128)
      )
    );
  }

  List<LayerOptions> layers = [];

  // add the map tiles
  layers.add(TileLayerOptions(
    urlTemplate: "https://api.mapbox.com/styles/v1/$MAPBOX_STYLE/tiles/{z}/{x}/{y}?access_token=$MAIN_TOKEN",
    additionalOptions: {
      'accessToken': MAIN_TOKEN,
      'id': 'mapbox/satellite-v9'

    },
  ));

  // add the boundary
  layers.add(PolygonLayerOptions(
      polygons: [
        Polygon(
          points: boundary,
          color: Colors.transparent,
          borderColor: DARK_ORANGE,
          borderStrokeWidth: 2,
        )
      ]
  ),);

  // add the tag markers
  layers.add(MarkerLayerOptions(
    markers: markers,
  ),);

  // if the user location in enables, add the user location via the UserLocationPlugin
  if(userLocationEnabled){
    layers.add(userLocationOptions);
  }

  return new FlutterMap(
    options: mapOptions,
    layers: layers,
    mapController: mapController,
  );
}

Expected behaviour
Expected to see the users location on the map.
And the map moving to keep the user in the centre of the screen.

Additional context
Testing on Android version 10

flutter_map: 0.10.1+1
  user_location:
    git:
      url: https://github.com/igaurab/user_location_plugin.git

Error using on openstreetmap layer

Describe the bug

════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════
The following NoSuchMethodError was thrown while handling a gesture:
The getter 'latitude' was called on null.
Receiver: null
Tried calling: latitude

When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 _MapsPluginLayerState._moveMapToCurrentLocation (package:user_location/src/user_location_layer.dart:168:33)
#2 _MapsPluginLayerState.build. (package:user_location/src/user_location_layer.dart:222:19)
#3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
#4 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:862:36)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#6335d
debugOwner: GestureDetector
state: ready
won arena
finalPosition: Offset(365.0, 779.0)
finalLocalPosition: Offset(11.0, 26.0)
button: 1
sent tap down
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by services library ══════════════════════════════════════════════════════
MissingPluginException(No implementation found for method listen on channel locationStatusStream)
════════════════════════════════════════════════════════════════════════════════════════════════════

To Reproduce
Click on the center icon bottom right

Desktop (please complete the following information):

  • OS: iOS iPhone 11 Simulator

Compass stream not canceled

User direction had been added by the following pull request: [https://github.com//pull/31] but the compass stream is not canceled on dispose.
I suggest changing this line

FlutterCompass.events.listen((double direction);

to

_compassStreamSubscription = FlutterCompass.events.listen((double direction);

so that subscription could be declared as

StreamSubscription<double> _compassStreamSubscription;

and canceled in dispose

@override
void dispose() {
    _compassStreamSubscription.cancel();
   ...

E/EventChannel#locationStatusStream(25617): Failed to close existing event stream

E/EventChannel#locationStatusStream(25617): Failed to close existing event stream
E/EventChannel#locationStatusStream(25617): java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter p0
E/EventChannel#locationStatusStream(25617): 	at com.example.user_location.UserLocationPlugin$Companion$registerWith$1.onCancel(Unknown Source:2)
E/EventChannel#locationStatusStream(25617): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:187)
E/EventChannel#locationStatusStream(25617): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:172)
E/EventChannel#locationStatusStream(25617): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/EventChannel#locationStatusStream(25617): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/EventChannel#locationStatusStream(25617): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/EventChannel#locationStatusStream(25617): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/EventChannel#locationStatusStream(25617): 	at android.os.Looper.loop(Looper.java:174)
E/EventChannel#locationStatusStream(25617): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/EventChannel#locationStatusStream(25617): 	at java.lang.reflect.Method.invoke(Native Method)
E/EventChannel#locationStatusStream(25617): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/EventChannel#locationStatusStream(25617): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Web support

Problem
When compiling flutter program for web location button is properly displayed, when clicking locate button an error is thrown

════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════
NoSuchMethodError: invalid member on null: 'latitude'
════════════════════════════════════════════════════════════════════════════════════════════════════

Solution
Add HTML5 geolocation support as described here:
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API

Location change notification not working as expected

Describe the bug
When the app is initially opened, and location permission is not given, the app awaits for location permission access. Once the permission is granted and the location access is toggled, the location access updates are not given.

On the other hand, if the location permission is already granted and then the location access is toggled, this status is given by the app.
To Reproduce
Steps to reproduce the behavior:

  1. Disable location permission
  2. Open the application
  3. Allow the location permission
  4. Turn off the location access of device
  5. See error: The app will not ask to turn on the location access of device.
    Expected behavior
    The app should remind user to turn on the location service, when it is turned off, no matter what.

Chaning updateMapLocationOnPositionChange value on runtime doesn't work

I'm changing the value of the property updateMapLocationOnPositionChange on runtime to false but when the location is update the map is moving to the current location.

The idea is deactivate the tracking when the user moves the map and activate again when the user clicks on the center fab button.

Any idea how to deal with it?

Thanks
Regards

Location service crashes the app

Describe the bug
When I open the app with the location service turned off, it gives me the prompt to ask if I want to enable the location service. If I click 'No Thanks' or 'OK', it reproduces the prompt again and if I choose again 'No Thanks' or 'OK', it crashes the app. This only happens when the app is opened with the location service turned off.

To Reproduce
Steps to reproduce the behavior:

  1. Turn off location service
  2. Open the app
  3. Choose 'No Thanks' or 'OK'
  4. See error

Expected behavior
Prompt disappears when 'No Thanks' is clicked or enables location service when 'OK' is clicked.

Smartphone (please complete the following information):

  • Device: Samsung A50
  • OS: Android
  • Version 10

defaultZoom not utilised

Describe the bug
While UserLocationOptions accepts defaultZoom as an argument, the setting does not seem to be utilised at all.

For example, I would expect the following snippet to open a map at the user's location with zoom level 19:

UserLocationOptions(
      context: context,
      mapController: mapController,
      markers: markers,
      zoomToCurrentLocationOnLoad: true,
      updateMapLocationOnPositionChange: false,
      defaultZoom: 19
    );

However, the method handling zoomToCurrentLocationOnLoad hard-codes a zoom level of 17:

_currentLocation, 17, widget.options.mapController, this);

Happy to submit a PR.

To Reproduce
Steps to reproduce the behavior:

  1. Create a map using the settings above
  2. Observe default zoom

Expected behavior
See above

Add possibility to stop the location update stream to avoid "power intensive background running"

Is your feature request related to a problem? Please describe.
On Android devices my app is listed as "power intensive apps running in the background" because of "high location frequency". It contains to request the location what is not needed in my case.

Describe the solution you'd like
A possibility to stop the location update stream. If I see it correctly the updates can be stopped.

Stream Emits events when application is running on the background

While I was testing out my other application I found that the current LatLang was being printed in the console. I have used location package to get the current location of the user, which listens to the current user location. The output in the console comes from the function implemented in the onlisten()

It seems like the issue of the location package that i have used:
Lyokone/flutterlocation#167

image

java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission

Tested on Android only

Upon initial launch, having yet to request location permissions, the following is thrown:

E/EventChannel#locationStatusStream( 7144): Failed to open event stream
E/EventChannel#locationStatusStream( 7144): java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.
E/EventChannel#locationStatusStream( 7144): 	at android.os.Parcel.createException(Parcel.java:2071)
E/EventChannel#locationStatusStream( 7144): 	at android.os.Parcel.readException(Parcel.java:2039)
E/EventChannel#locationStatusStream( 7144): 	at android.os.Parcel.readException(Parcel.java:1987)
E/EventChannel#locationStatusStream( 7144): 	at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:1151)
E/EventChannel#locationStatusStream( 7144): 	at android.location.LocationManager.requestLocationUpdates(LocationManager.java:1019)
E/EventChannel#locationStatusStream( 7144): 	at android.location.LocationManager.requestLocationUpdates(LocationManager.java:558)
E/EventChannel#locationStatusStream( 7144): 	at com.example.user_location.UserLocationPlugin$Companion$registerWith$1.onListen(UserLocationPlugin.kt:48)
E/EventChannel#locationStatusStream( 7144): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:193)
E/EventChannel#locationStatusStream( 7144): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:172)
E/EventChannel#locationStatusStream( 7144): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/EventChannel#locationStatusStream( 7144): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/EventChannel#locationStatusStream( 7144): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/EventChannel#locationStatusStream( 7144): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/EventChannel#locationStatusStream( 7144): 	at android.os.Looper.loop(Looper.java:174)
E/EventChannel#locationStatusStream( 7144): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/EventChannel#locationStatusStream( 7144): 	at java.lang.reflect.Method.invoke(Native Method)
E/EventChannel#locationStatusStream( 7144): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/EventChannel#locationStatusStream( 7144): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/EventChannel#locationStatusStream( 7144): Caused by: android.os.RemoteException: Remote stack trace:
E/EventChannel#locationStatusStream( 7144): 	at com.android.server.LocationManagerService.checkResolutionLevelIsSufficientForProviderUseLocked(LocationManagerService.java:1937)
E/EventChannel#locationStatusStream( 7144): 	at com.android.server.LocationManagerService.requestLocationUpdates(LocationManagerService.java:2500)
E/EventChannel#locationStatusStream( 7144): 	at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:468)
E/EventChannel#locationStatusStream( 7144): 	at android.os.Binder.execTransactInternal(Binder.java:1021)
E/EventChannel#locationStatusStream( 7144): 	at android.os.Binder.execTransact(Binder.java:994)
E/EventChannel#locationStatusStream( 7144): 
I/flutter ( 7144): Flutter error caught by Crashlytics plugin:
I/flutter ( 7144): ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
I/flutter ( 7144): The following PlatformException was thrown while activating platform stream on channel
I/flutter ( 7144): locationStatusStream:
I/flutter ( 7144): PlatformException(error, "gps" location provider requires ACCESS_FINE_LOCATION permission., null)
I/flutter ( 7144): 
I/flutter ( 7144): When the exception was thrown, this was the stack:
I/flutter ( 7144): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
I/flutter ( 7144): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
I/flutter ( 7144): <asynchronous suspension>
I/flutter ( 7144): #2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:517:29)
I/flutter ( 7144): #4      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:503:64)
I/flutter ( 7144): #9      _MapsPluginLayerState._handleLocationChanges (package:user_location/src/user_location_layer.dart:222:40)
I/flutter ( 7144): #10     _MapsPluginLayerState.initialize.<anonymous closure>.<anonymous closure> (package:user_location/src/user_location_layer.dart:81:13)
I/flutter ( 7144): #12     _MapsPluginLayerState.initialize.<anonymous closure>.<anonymous closure> (package:user_location/src/user_location_layer.dart:75:40)
I/flutter ( 7144): #21     MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart)
I/flutter ( 7144): (elided 28 frames from package dart:async and package dart:async-patch)
I/flutter ( 7144): ════════════════════════════════════════════════════════════════════════════════════════════════════

Error after hide map screen

E/flutter (32734): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: setState() called after dispose(): _MapsPluginLayerState#50975(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)
E/flutter (32734): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
E/flutter (32734): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
E/flutter (32734): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
E/flutter (32734): #0      State.setState.<anonymous closure> 
package:flutter/…/widgets/framework.dart:1112
E/flutter (32734): #1      State.setState 
package:flutter/…/widgets/framework.dart:1147
E/flutter (32734): #2      _MapsPluginLayerState._handleCompassDirection.<anonymous closure> 
package:user_location/src/user_location_layer.dart:240
E/flutter (32734): #3      _rootRunUnary  (dart:async/zone.dart:1134:38)
E/flutter (32734): #4      _CustomZone.runUnary  (dart:async/zone.dart:1031:19)
E/flutter (32734): #5      _CustomZone.runUnaryGuarded  (dart:async/zone.dart:933:7)
E/flutter (32734): #6      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:338:11)
E/flutter (32734): #7      _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:265:7)
E/flutter (32734): #8      _SyncStreamControllerDispatch._sendData  (dart:async/stream_controller.dart:766:19)
E/flutter (32734): #9      _StreamController._add  (dart:async/stream_controller.dart:642:7)
E/flutter (32734): #10     _StreamController.add  (dart:async/stream_controller.dart:588:5)
E/flutter (32734): #11     _rootRunUnary  (dart:async/zone.dart:1134:38)
E/flutter (32734): #12     _CustomZone.runUnary  (dart:async/zone.dart:1031:19)
E/flutter (32734): #13     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:933:7)
E/flutter (32734): #14     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:338:11)
E/flutter (32734): #15     _DelayedData.perform  (dart:async/stream_impl.dart:593:14)
E/flutter (32734): #16     _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:709:11)
E/flutter (32734): #17     _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:669:7)
E/flutter (32734): #18     _rootRun  (dart:async/zone.dart:1122:38)
E/flutter (32734): #19     _CustomZone.run  (dart:async/zone.dart:1023:19)
E/flutter (32734): #20     _CustomZone.runGuarded  (dart:async/zone.dart:925:7)
E/flutter (32734): #21     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:965:23)
E/flutter (32734): #22     _rootRun  (dart:async/zone.dart:1126:13)
E/flutter (32734): #23     _CustomZone.run  (dart:async/zone.dart:1023:19)
E/flutter (32734): #24     _CustomZone.runGuarded  (dart:async/zone.dart:925:7)
E/flutter (32734): #25     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:965:23)
E/flutter (32734): #26     _microtaskLoop  (dart:async/schedule_microtask.dart:43:21)
E/flutter (32734): #27     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:52:5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.