试图嵌入平台视图,但PaintContext不支持嵌入

问题描述 投票:0回答:1

我正在尝试将google地图添加到我的项目中,但是地图是self而不是在ios模拟器上显示

这是运行小部件时得到的信息

[VERBOSE-2:platform_view_layer.cc(38)] Trying to embed a platform view but the PaintContext does not support embedding
Google Maps SDK for iOS version: 3.4.0.0
    [C1.1 3DBF24C4-522B-4596-B9CD-9F9A538547E8 172.20.10.4:51304<->172.217.22.110:443]
    Connected Path: satisfied (Path is satisfied), interface: en0
    Duration: 0.791s, DNS @0.009s took 0.078s, TCP @0.091s took 0.163s, TLS took 0.337s
    bytes in/out: 4277/672, packets in/out: 9/8, rtt: 0.155s, retransmitted packets: 0, out-of-order packets: 0

我试图添加

<key>io.flutter.embedded_views_preview</key>
    <true/>

到info.plist,

还将地图SDK更新到最新版本

这是我的代码

 static const LatLng _center = const LatLng(45.521563, -122.677433);

  void _onMapCreated(GoogleMapController controller) {
    _controller.complete(controller);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Maps Sample App'),
          backgroundColor: Colors.green[700],
        ),
        body: GoogleMap(
          onMapCreated: _onMapCreated,
          initialCameraPosition: CameraPosition(
            target: _center,
            zoom: 11.0,
          ),
        ),
      ),
    );
  }
flutter flutter-dependencies
1个回答
0
投票

尝试退出模拟器,然后重新启动,再次单击flutter run。我认为-R热重启不会重新加载Info.plist

© www.soinside.com 2019 - 2024. All rights reserved.