Home > other >  The argument type 'LatLng' can't be assigned to the parameter type 'LatLng*'
The argument type 'LatLng' can't be assigned to the parameter type 'LatLng*'

Time:09-02

I get this error : The argument type 'LatLng' can't be assigned to the parameter type 'LatLng*'

this is not like this question that is asked before.

I import all needed package that recommended on doc of flutter_map.

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:latlong2/latlong.dart';

I assign LatLng to center.

options: MapOptions(
          center: LatLng(0.0, 0.0),
          zoom: 4.0,
          maxZoom: 19.0,
        ),

CodePudding user response:

Try with prefix

import 'package:latlong2/latlong.dart' as latlg2;
...
 center: latlg2.LatLng(0.0, 0.0),

CodePudding user response:

I solved

in import list I removed 2 from latlong2 to become

import 'package:latlong/latlong.dart';

and it worked. even that in the documentation we have 2 in backage name

  • Related