flutter_baidu_mapapi_base 3.7.0 copy "flutter_baidu_mapapi_base: ^3.7.0" to clipboard
flutter_baidu_mapapi_base: ^3.7.0 copied to clipboard

The flutter_baidu_mapapi_base plugin offer public flutter and native(include Android and iOS) lib for other components.

example/lib/main.dart

import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';

Future<void> 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 BMFMapBaseVersion.nativeBaseVersion;
  print('获取原生地图版本号:$map');
  runApp(new MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  // String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    // initPlatformState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('flutter_baidu_mapapi_base \n'),
        ),
      ),
    );
  }
}
9
likes
115
pub points
90%
popularity

Publisher

unverified uploader

The flutter_baidu_mapapi_base plugin offer public flutter and native(include Android and iOS) lib for other components.

Homepage

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_baidu_mapapi_base