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

Location data type error, and listener error iOS #2

Open
rogeliotrejo13 opened this issue Mar 28, 2019 · 2 comments
Open

Location data type error, and listener error iOS #2

rogeliotrejo13 opened this issue Mar 28, 2019 · 2 comments

Comments

@rogeliotrejo13
Copy link

Compiler message:
lib/fragments/startrequest.dart:41:37: Error: The method 'listen' isn't defined for the class
'Stream Function()'.

  • 'Stream' is from 'dart:async'.
  • 'LocationData' is from 'package:location/location.dart'
    ('file:///Users/roger/development/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.3.2/lib/location.d
    art').
    Try correcting the name to the name of an existing method, or defining a method named 'listen'.
    _location.onLocationChanged.listen((Map<String, double> result) {
    ^^^^^^
    lib/fragments/startrequest.dart:54:18: Error: A value of type 'Future Function()' can't be
    assigned to a variable of type 'Map<String, double>'.
  • 'Future' is from 'dart:async'.
  • 'LocationData' is from 'package:location/location.dart'
    ('file:///Users/roger/development/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.3.2/lib/location.d
    art').
  • 'Map' is from 'dart:core'.
    Try changing the type of the left hand side, or casting the right hand side to 'Map<String, double>'.
    location = await _location.getLocation;
    ^
    Compiler failed on /Users/roger/flutter/flutter_app/lib/main.dart
    Error launching application on iPhone Xʀ.
@buddhika-ranasinghe
Copy link

Same issue in Android
Did anyone fixed this error ???

@macobse
Copy link

macobse commented Sep 25, 2019

The below is how I've fixed the issue

  1. onLocationChanged is a function. change it to onLocationChanged()
  2. add the location dependancy verison like
    location: ^1.4.1
    and run flutter packages get command.
    good luck!

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

3 participants