Basemap.withLayers constructor

Basemap.withLayers({
  1. required List<Layer> baseLayers,
  2. required List<Layer> referenceLayers,
})

Creates a basemap with collections of base and reference layers.

Parameters:

  • baseLayers — A collection of layers that serve as base layers.
  • referenceLayers — A collection of layers that serve as reference layers.

Implementation

factory Basemap.withLayers({
  required List<Layer> baseLayers,
  required List<Layer> referenceLayers,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreBaseLayers = baseLayers.toMutableArray(
    valueType: _ElementType.layer,
  );
  final coreReferenceLayers = referenceLayers.toMutableArray(
    valueType: _ElementType.layer,
  );
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_Basemap_createWithLayers(
      coreBaseLayers._handle,
      coreReferenceLayers._handle,
      errorHandler,
    );
  });
  final Basemap object = Basemap._instanceCache.instanceWith(handle);
  object._baseLayers.value.setCache(baseLayers);
  object._referenceLayers.value.setCache(referenceLayers);
  return object;
}