setAMapKey function

Future<bool> setAMapKey({
  1. required String iosKey,
  2. required String androidKey,
  3. bool isAgree = true,
  4. bool isContains = true,
  5. bool isShow = true,
})

设置ios&android的key

Implementation

Future<bool> setAMapKey({
  required String iosKey,
  required String androidKey,

  /// 设置是否同意用户授权政策 设置为true才可以调用其他功能
  bool isAgree = true,

  /// 设置包含隐私政策 设置为true才可以调用其他功能
  bool isContains = true,

  /// 并展示用户授权弹窗 设置为true才可以调用其他功能
  bool isShow = true,
}) async {
  if (!_supportPlatform) return false;
  String? key;
  if (_isAndroid) key = androidKey;
  if (_isIOS) key = iosKey;
  if (key == null) return false;
  final bool? state = await FlAMapLocation()._channel.invokeMethod(
      'setApiKey', {
    'key': key,
    'isAgree': isAgree,
    'isContains': isContains,
    'isShow': isShow
  });
  return state == true;
}