Skip to content

Location data type error, and listener error iOS #2

@rogeliotrejo13

Description

@rogeliotrejo13

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ʀ.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions