Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError: The getter 'last' was called on null. #48

Closed
dagovalsusa opened this issue Jan 9, 2019 · 1 comment
Closed

NoSuchMethodError: The getter 'last' was called on null. #48

dagovalsusa opened this issue Jan 9, 2019 · 1 comment

Comments

@dagovalsusa
Copy link

Plugin doesn't work, i use the forked plugin by shehabic https://github.com/shehabic/geolocation for Dart 2 compatibility

this is the error that return

[VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception:
NoSuchMethodError: The getter 'last' was called on null.
Receiver: null
Tried calling: last
#0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1 LocationResult.location (file:///Library/flutter/.pub-cache/git/geolocation-5f7e2ec8a00fa0c020791c5b0c1844b2bd320c05/lib/data/location_result.dart:27:38)
#2 LocationResult.dataToString (file:///Library/flutter/.pub-cache/git/geolocation-5f7e2ec8a00fa0c020791c5b0c1844b2bd320c05/lib/data/location_result.dart:31:12)
#3 _MyHomePageState.initGeolocation. (package:sequi/main.dart:77:25)
#4 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#5 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#6 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
#7 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:707:11)
#8 _PendingEvents.schedule. (dart:async/stream_impl.dart<…>

my code is very simple,

// init background geolocation
void initGeolocation() async {
debugPrint('geo');
_geoSubscription = Geolocation.locationUpdates(
accuracy: LocationAccuracy.best,
displacementFilter: 10.0, // in meters
inBackground:
true, // by default, location updates will pause when app is inactive (in background). Set to true to continue updates in background.
).listen((result) {
debugPrint('result');
debugPrint(result.dataToString());
if (result.isSuccessful) {
// todo with result
_latitude = result.location.latitude;
_longitude = result.location.longitude;
debugPrint(result.dataToString());
}
});
}

@lukaspili
Copy link
Contributor

Sorry for the delay. It should be fixed in the latest release 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants