updateCoordinates method Null safety

Future<bool> updateCoordinates(
  1. List<BMFCoordinate> coordinates,
  2. {List<int>? indexs}
)

更新经纬度数组

List<BMFCoordinate> coordinates gradientLine经纬度数组

iOS 更新经纬度数组的同时,必须更新indexs

Implementation

Future<bool> updateCoordinates(List<BMFCoordinate> coordinates,
    {List<int>? indexs}) async {
  ArgumentError.checkNotNull(coordinates, "coordinates");
  if (Platform.isIOS) {
    ArgumentError.checkNotNull(indexs, "indexs");
  }
  bool ret = await BMFMapDispatcherFactory.instance.overlayDispatcher
      .updateGradientLineMember(this.methodChannel, {
    'id': this.id,
    'member': 'coordinates',
    'value': coordinates.map((coordinate) => coordinate.toMap()).toList(),
    'indexs': indexs?.map((index) => index).toList()
  });

  if (ret) {
    this.coordinates = coordinates;
    if (Platform.isIOS) {
      if (null != indexs) {
        this.indexs = indexs;
      }
    }
  }

  return ret;
}