小编SBR*_*R90的帖子

参数类型“double?” 不能分配给参数类型“double”。dart(参数类型不可分配)

我试图获取用户当前位置,但在 l.latitude 和 l.longitude 上出现此错误

参数类型“double?” 不能分配给参数类型“double”。

void _onMapCreated(GoogleMapController _cntlr) {
    _controller = _cntlr;
    _location.onLocationChanged.listen((l) {
      _controller.animateCamera(
        CameraUpdate.newCameraPosition(
          CameraPosition(
            target: LatLng(l.latitude, l.longitude),
            zoom: 15,
          ),
        ),
      );
    });
  }

Run Code Online (Sandbox Code Playgroud)

google-maps position dart flutter

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

dart ×1

flutter ×1

google-maps ×1

position ×1