onInit method

  1. @override
Future<void> onInit()
override

Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.

Implementation

@override
Future<void> onInit() async {
  super.onInit();
  bool key = await setAMapKey(iosKey: iosKey, androidKey: androidKey);

  aMapLocation = FlAMapLocation();
  bool data = await aMapLocation.initialize(AMapLocationOption());
  print('高德地图ApiKey设置${key && data ? '成功' : '失败'}');
}