You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.
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:
Implement location plugin in flutter project widget with flutter_map
Write test that starts the widget
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.
The text was updated successfully, but these errors were encountered:
A workaround is adding the user plugin to the map only when user location permission has been granted.
Still, would be nice if the plugin could work without throwing erros even with missing user location permission.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When I use the location plugin in my app, all tests fail with an NoSuchMethodError / Null Pointer Error.
Apparently the
_onLocationChangedStreamSubscription
listener is never initialized but waiting in theuser_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:
Expected behavior
No error, even without location permissions response.
Environment:
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.
The text was updated successfully, but these errors were encountered: