"TargetPlatform.fuchsia is not yet supported by the maps plugin" 使用 google_maps_flutter 显示此文本而不是 google 地图

"TargetPlatform.fuchsia is not yet supported by the maps plugin" this text is displayed instead of google map using google_maps_flutter

我正在尝试使用 google_maps_flutter 包,但地图插件尚不支持 TargetPlatform.fuchsia 而不是地图,我在控制台中没有收到任何错误。我已将包含 API 键的元数据条目添加到 android/app/src/main 中的 AndroidManifest.xml 文件。

received message instead of the map

下面是我的代码。

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  GoogleMapController mapController;

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

  void _onMapCreated(GoogleMapController controller) {
    mapController = 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,
          ),
        ),
      ),
    );
  }
}

我该如何解决这个问题?

问题出在main.dart中的一行代码:

debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;

我把它注释掉了,问题就解决了。