### Example pubspec.yaml Dependency Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.9.5/install An example of how the flutter_baidu_mapapi_map dependency appears in a Flutter project's pubspec.yaml file. This line is automatically added by `dart pub add` or `flutter pub add`. ```yaml dependencies: flutter_baidu_mapapi_map: ^3.9.5 ``` -------------------------------- ### Example pubspec.yaml Dependency Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.5.0/install This snippet shows how the flutter_baidu_mapapi_map package is listed under the dependencies section in your project's pubspec.yaml file after running `flutter pub add`. ```yaml dependencies: flutter_baidu_mapapi_map: ^3.5.0 ``` -------------------------------- ### Example pubspec.yaml Dependency Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.3.0/install Shows the expected format for the flutter_baidu_mapapi_map dependency declaration within a Flutter project's pubspec.yaml file. ```yaml dependencies: flutter_baidu_mapapi_map: ^3.3.0 ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/2.0.1/example Initializes the Baidu Map SDK for Flutter applications. It handles API key setup and coordinate type configuration, with platform-specific logic for iOS and Android. Requires the 'flutter_baidu_mapapi_base' dependency. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } ``` -------------------------------- ### Add flutter_baidu_mapapi_map to pubspec.yaml Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.9.1/install This YAML snippet shows how to declare the flutter_baidu_mapapi_map package as a dependency in your project's pubspec.yaml file. This is a manual way to add the dependency, often followed by `dart pub get` or `flutter pub get`. ```yaml dependencies: flutter_baidu_mapapi_map: ^3.9.1 ``` -------------------------------- ### Add flutter_baidu_mapapi_map Dependency using Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.5.0/install This command adds the flutter_baidu_mapapi_map package as a dependency to your Flutter project. It automatically updates your pubspec.yaml file and runs `flutter pub get`. ```bash flutter pub add flutter_baidu_mapapi_map ``` -------------------------------- ### Add flutter_baidu_mapapi_map Dependency Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.3.0/install Instructions for adding the flutter_baidu_mapapi_map package to a Flutter project's dependencies using the Flutter CLI. This command updates the pubspec.yaml file and performs a package get. ```bash $ flutter pub add flutter_baidu_mapapi_map ``` -------------------------------- ### Add flutter_baidu_mapapi_map Dependency (Dart) Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.9.0/install This command adds the flutter_baidu_mapapi_map package as a dependency to your Dart project. It automatically updates your pubspec.yaml file and runs `dart pub get`. ```bash $ dart pub add flutter_baidu_mapapi_map ``` -------------------------------- ### Initialize Baidu Map SDK and Run App (Dart) Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/2.0.0/example This Dart code snippet demonstrates how to initialize the Baidu Map SDK for Flutter applications. It handles platform-specific API key and coordinate type settings for iOS and Android. It also retrieves and prints the native map version. This code is essential for setting up the map functionality. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.2.0/example This code snippet demonstrates the initialization process for the Baidu Map SDK within a Flutter application. It handles platform-specific API key configurations and privacy agreement settings. Dependencies include 'dart:io', 'flutter/material.dart', 'flutter_baidu_mapapi_base', and 'flutter_baidu_mapapi_map'. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.0.0%2B1/example Initializes the Baidu Map SDK for Flutter applications, setting the API key and coordinate type. It handles platform-specific configurations for iOS and Android. Dependencies include 'dart:io', 'flutter/material.dart', 'flutter_baidu_mapapi_map', 'flutter_baidu_mapapi_base', and 'flutter_baidu_mapapi_base'. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.9.1/example This snippet demonstrates the initialization of the Baidu Map SDK for Flutter applications. It handles platform-specific API key and coordinate type settings for both iOS and Android, and includes privacy agreement acceptance. Dependencies include `flutter_baidu_mapapi_base` and `flutter_baidu_mapapi_map`. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { /// 初始化获取Android 系统版本号 await BMFAndroidVersion.initAndroidVersion(); // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Import flutter_baidu_mapapi_map in Dart Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.3.0/install Demonstrates how to import the flutter_baidu_mapapi_map plugin into your Dart files to begin using its map functionalities within a Flutter application. ```dart import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.3.1/example This code snippet demonstrates the initialization process for the Baidu Map SDK within a Flutter application. It includes setting the privacy agreement, API key, and coordinate type, with platform-specific configurations for Android and iOS. Dependencies include `dart:io`, `flutter/material.dart`, `flutter_baidu_mapapi_base`, and `flutter_baidu_mapapi_map`. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { /// 初始化获取Android 系统版本号 await BMFAndroidVersion.initAndroidVersion(); // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/example This code snippet demonstrates how to initialize the Baidu Map SDK for Flutter applications. It includes setting the privacy agreement, configuring API keys for iOS, and initializing Android-specific settings. Dependencies include dart:io, flutter/material.dart, flutter_baidu_mapapi_base, and flutter_baidu_mapapi_map. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { /// 初始化获取Android 系统版本号 await BMFAndroidVersion.initAndroidVersion(); // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Add flutter_baidu_mapapi_map to pubspec.yaml Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.7.0/install This snippet shows how to manually add the flutter_baidu_mapapi_map package to your project's pubspec.yaml file. This is an alternative to using the `pub add` command and ensures the package is listed under project dependencies. ```yaml dependencies: flutter_baidu_mapapi_map: ^3.7.0 ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.7.1/example This code snippet demonstrates the initialization of the Baidu Map SDK within a Flutter application. It includes setting the privacy agreement, configuring API keys and coordinate types for both iOS and Android platforms, and retrieving the native map version. Platform-specific logic is used for Android initialization. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' \ show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { /// 初始化获取Android 系统版本号 await BMFAndroidVersion.initAndroidVersion(); // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK and Set API Key in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.3.2/example This code snippet demonstrates the initialization of the Baidu Map SDK for Flutter applications. It includes setting the privacy agreement, configuring the API key and coordinate type for both iOS and Android platforms, and retrieving the native map version. Dependencies include 'dart:io', 'flutter/material.dart', 'flutter_baidu_mapapi_base', and 'flutter_baidu_mapapi_map'. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { /// 初始化获取Android 系统版本号 await BMFAndroidVersion.initAndroidVersion(); // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Add flutter_baidu_mapapi_map Dependency (Dart) Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.7.0/install This command adds the flutter_baidu_mapapi_map package as a dependency to your Dart project. It ensures that the package is available for use in your project's code and handles the download and integration process. ```bash dart pub add flutter_baidu_mapapi_map ``` -------------------------------- ### Add flutter_baidu_mapapi_map Dependency with Dart Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.9.5/install Command to add the flutter_baidu_mapapi_map package as a dependency to your Dart project using the Dart CLI. This ensures the package is listed in your pubspec.yaml. ```bash $ dart pub add flutter_baidu_mapapi_map ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.1.0/example This code snippet demonstrates the initialization of the Baidu Map SDK within a Flutter application. It includes setting the privacy agreement, API key (for iOS), and coordinate type. It also retrieves the native map version. Dependencies include flutter, flutter_baidu_mapapi_base, and flutter_plugin_android_lifecycle. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnNkzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK and Set API Key in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.1.0%2B1/example This code snippet demonstrates the initialization of the Baidu Map SDK within a Flutter application. It includes setting the privacy agreement and configuring the API key and coordinate type, with platform-specific logic for iOS and Android. The initialization also includes retrieving the native map version. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ``` -------------------------------- ### Initialize Baidu Map SDK with API Key in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.0.0%2B2/example Initializes the Baidu Map SDK for Flutter applications. It sets the API key and coordinate type, with platform-specific handling for iOS and Android. Note that Android requires API key configuration in the Manifest file. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('百度地图flutter插件Demo'), ), body: Container()), ); } } ``` -------------------------------- ### Add flutter_baidu_mapapi_map Dependency with Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.9.5/install Command to add the flutter_baidu_mapapi_map package as a dependency to your Flutter project using the Flutter CLI. This command automatically updates your pubspec.yaml file. ```bash $ flutter pub add flutter_baidu_mapapi_map ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.0.0/example Initializes the Baidu Map SDK for both iOS and Android platforms. For iOS, it sets an API key and coordinate type. For Android, it sets the coordinate type and notes that the API key should be configured in the AndroidManifest.xml file. This function requires the 'flutter_baidu_mapapi_base' package. ```dart import 'dart:io' show Platform; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; Future main() async { // ... other initialization code ... // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType( 'yFDD3IlfSk2xTdQ0G41MjRnDjzd5gUVG1C', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } // ... rest of the main function ... } ``` -------------------------------- ### Retrieve Native Baidu Map Version in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.0.0/example Retrieves the native Baidu Map SDK version information. This function returns a Map containing version details. It requires the 'flutter_baidu_mapapi_map' package and should be called after the SDK has been initialized. ```dart import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart' as BMFMapAPI_Map; // ... inside an async function ... Map? map = await BMFMapAPI_Map.nativeMapVersion; print('获取原生地图版本号:$map'); ``` -------------------------------- ### Initialize Baidu Map SDK in Flutter Source: https://pub.dev/packages/flutter_baidu_mapapi_map/versions/3.2.1/example This snippet shows how to initialize the Baidu Map SDK within a Flutter application. It includes setting the privacy agreement, configuring the API key and coordinate type for iOS, and setting the coordinate type for Android. It also demonstrates retrieving the native map version. ```dart import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart' show BMFMapSDK, BMF_COORD_TYPE; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map_example/CustomWidgets/map_appbar.dart'; import 'flutter_map_demo.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); /// 设置用户是否同意SDK隐私协议 BMFMapSDK.setAgreePrivacy(true); // 百度地图sdk初始化鉴权 if (Platform.isIOS) { BMFMapSDK.setApiKeyAndCoordType('请输入您的AK', BMF_COORD_TYPE.BD09LL); } else if (Platform.isAndroid) { // Android 目前不支持接口设置Apikey, // 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); } Map? map = await BMFMapVersion.nativeMapVersion; print('获取原生地图版本号:$map'); runApp(new MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: BMFAppBar( title: '百度地图flutter插件Demo', isBack: false, ), body: FlutterBMFMapDemo()), ); } } ```