updateSatellite method

void updateSatellite(
  1. String id, {
  2. GlobeCoordinates? coordinates,
  3. double? altitude,
  4. String? label,
  5. Widget? labelBuilder(
    1. BuildContext context,
    2. Satellite satellite,
    3. bool isHovering,
    4. bool isVisible,
    )?,
  6. bool? isLabelVisible,
  7. Offset? labelOffset,
  8. SatelliteStyle? style,
  9. TextStyle? labelTextStyle,
  10. SatelliteOrbit? orbit,
  11. VoidCallback? onTap,
  12. VoidCallback? onHover,
})

Updates an existing satellite on the globe.

The id parameter represents the id of the satellite to be updated.

Example usage:

controller.updateSatellite('iss',
  label: 'International Space Station',
  style: SatelliteStyle(size: 10, color: Colors.blue),
);

Implementation

void updateSatellite(
  String id, {
  GlobeCoordinates? coordinates,
  double? altitude,
  String? label,
  Widget? Function(BuildContext context, Satellite satellite, bool isHovering,
          bool isVisible)?
      labelBuilder,
  bool? isLabelVisible,
  Offset? labelOffset,
  SatelliteStyle? style,
  TextStyle? labelTextStyle,
  SatelliteOrbit? orbit,
  VoidCallback? onTap,
  VoidCallback? onHover,
}) {
  final index = satellites.indexWhere((element) => element.id == id);
  if (index != -1) {
    satellites[index] = satellites[index].copyWith(
      coordinates: coordinates,
      altitude: altitude,
      label: label,
      labelBuilder: labelBuilder,
      isLabelVisible: isLabelVisible,
      labelOffset: labelOffset,
      style: style,
      labelTextStyle: labelTextStyle,
      orbit: orbit,
      onTap: onTap,
      onHover: onHover,
    );
    notifyListeners();
  }
}