toggle method

Future<void> toggle(
  1. String layerId
)

Toggle visibility of a layer.

Implementation

Future<void> toggle(String layerId) async {
  final state = getLayerState(layerId);
  if (!state['loaded']) {
    await show(layerId);
  } else {
    if (state['visible']) {
      await hide(layerId);
    } else {
      await show(layerId);
    }
  }
}