cn_locate 0.0.5 copy "cn_locate: ^0.0.5" to clipboard
cn_locate: ^0.0.5 copied to clipboard

A new flutter plugin project.

cn_locate #

封装的原生flutter高德定位组件.

用法 #

import 'package:cn_locate/cn_locate.dart';
...
initLocation() async {
    // if (await Permission.location.serviceStatus.isEnabled) {
    //   var options = AMapOptions(
    //       locationMode: LocationMode.hightAccuracy, isNeedAddress: true);
    //   CnLocate.init(
    //       options: options,
    //       callBack: (result) {
    //         print("------sdk初始化${result.message}");
    //       });
    // } else {
    if (await Permission.locationWhenInUse.request().isGranted) {
      if (await Permission.locationAlways.request().isGranted) {
        var options = AMapOptions(
            locationMode: LocationMode.hightAccuracy,
            isNeedAddress: true,
            interval: 10000,
            isGpsFirst: true,
            isMockEnable: true,
            isOnceLocation: false,
            apiKey: "0f5ae242daaa662569c2806f426b7020");
        CnLocate.init(
            options: options,
            callBack: (result) {
              print("------sdk初始化${result.message}");
            });
        CnLocate.onLocationChange.listen((event) {
          print(event);//返回定位成功后的坐标
        });
      } else {
        openAppSettings();
      }
    }
    //}
  }
0
likes
105
pub points
0%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on cn_locate