FeatureLayer.withItem constructor

FeatureLayer.withItem(
  1. {required Item featureServiceItem,
  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:

  • featureServiceItem — 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 featureServiceItem, required int layerId}) {
  _initializeArcGISEnvironmentIfNeeded();
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_FeatureLayer_createWithItem(
        featureServiceItem._handle, layerId, errorHandler);
  });
  return Layer._instanceCache.instanceWith(handle);
}