FeatureLayer.withItem constructor

FeatureLayer.withItem({
  1. required Item item,
  2. required int layerId,
})

Creates a new feature layer object from a feature service portal item.

The feature layer will fail to load if an invalid portal item is passed in.

Parameters:

  • item — A feature service PortalItem. The item's type must be PortalItemType.featureService.
  • layerId — The layer id of an individual layer in the ArcGIS feature service represented by the item parameter.

Implementation

factory FeatureLayer.withItem({
  required Item item,
  required int layerId,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_FeatureLayer_createWithItem(
      item._handle,
      layerId,
      errorHandler,
    );
  });
  return Layer._instanceCache.instanceWith(handle);
}