Flutter中的Google Maps Place Picker软件包错误

Flutter中的Google Maps Place Picker软件包错误

问题描述:

当我尝试在Flutter中使用 google_maps_place_picker 包运行以下代码时,我收到大量错误提示.

I am getting a huge list of error when I try to run the following code with google_maps_place_picker package in flutter.

import 'package:flutter/material.dart';
// import 'package:google_maps/google_maps.dart';
import 'package:google_maps/google_maps.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'
    as place;
// import 'package:location/location.dart';

import '../components/location_helper.dart';
// import '../components/location_helper.dart';

class MapScreen extends StatelessWidget {
  final LatLng location1 = LatLng(37.657, -122.776);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Map Screen'),
        ),
        body: Center(
          child: place.PlacePicker(
              apiKey: GOOGLE_API,
              useCurrentLocation: true,
              onPlacePicked: (result) {
                print(result.addressComponents);
                Navigator.of(context).pop();
              }),
        ));
  }
}

错误

5:8:错误:找不到:'dart:html'导入'dart:html'显示文档,元素,节点;

5:8: Error: Not found: 'dart:html' import 'dart:html' show Document, Element, Node;

错误:找不到:'dart:js'导出'dart:js'显示allowInterop,allowInteropCaptureThis;

Error: Not found: 'dart:js' export 'dart:js' show allowInterop, allowInteropCaptureThis;

错误:找不到:'dart:js_util'导出'dart:js_util';

Error: Not found: 'dart:js_util' export 'dart:js_util';

错误:找不到类型'元素'.元素mapDiv,[^^^^^^^^

Error: Type 'Element' not found. Element mapDiv, [ ^^^^^^^

错误:找不到类型节点".列表< MVCArray>获取控件=>^^^^

Error: Type 'Node' not found. List<MVCArray> get controls => ^^^^

错误:找不到类型'元素'.元素_getDiv()=>callMethod(this,'getDiv',[]);^^^^^^^^

Error: Type 'Element' not found. Element _getDiv() => callMethod(this, 'getDiv', []); ^^^^^^^

这些只是我所犯的一些错误.还有更多类似这些的东西.

These are just some of the errors I have put. There are MANY more like these.

我已在pubspec.yaml文件中添加了这些依赖项.

I have added these dependencies in my pubspec.yaml file.

  google_maps_flutter: ^1.2.0
  geodesy: ^0.3.2
  confirm_dialog: ^0.1.1
  geocoding: ^1.0.5
  geocoder: ^0.2.1
  google_maps_place_picker: ^1.0.1
  tuple: ^1.0.3
  js: ^0.6.2
  html: ^0.14.0+4

您正在使用 import'package:google_maps/google_maps.dart';

google_maps软件包仅支持网络.要获得移动支持,请尝试 flutter_google_places google_maps_flutter 或任何其他软件包.

google_maps package only supports web. For mobile support should try out flutter_google_places, google_maps_flutter or any other package.