1、pubspec.yaml文件中引入baidu_map_map库
name: amap_base_example
description: Demonstrates how to use the amap_base plugin.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
amap_base_map:
path: ../
decorated_flutter: any
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
- amap_assets/
2、在需要显示地图的页面文件中import 'package:baidu_map_map/baidu_map_map.dart'
import 'package:baidu_map_map/baidu_map_map.dart';
...此处,代码省略...
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Container(
child: BaiduMapView(),
)
),
);
}
...此处,代码省略...