setOpacity method

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

Sets the opacity of a layer or geometry source (0.0 to 1.0). This provides a unified API matching the Web SDK.

Implementation

Future<void> setOpacity(String id, double opacity) async {
  // 1. Try treating as a Geometry source first
  await geometry.setOpacity(id, opacity);
  // 2. Then try as a Catalog layer
  await layers.setOpacity(id, opacity);
}