setOpacity method

Future<void> setOpacity(
  1. String layerId,
  2. double opacity
)

Set the opacity of a layer (0.0 to 1.0).

Implementation

Future<void> setOpacity(String layerId, double opacity) async {
  final item = _findItem(layerId);
  if (item == null) return; // Not a catalog layer, skip silently

  if (!_ensured.contains(layerId)) {
    await ensure(layerId);
  }
  _layerState[layerId]?['opacity'] = opacity;
  _applyStateChanges(layerId);
}