FeatureCollectionTable.withGeoElements constructor

FeatureCollectionTable.withGeoElements(
  1. {required List<GeoElement> geoElements,
  2. required List<Field> fields}
)

Creates a FeatureCollectionTable populated from the specified GeoElement collection.

The geometry type and spatial reference will be inferred from the geo-elements passed in. Note that this constructor may take some time to complete depending on how many geo-elements are passed in.

Parameters:

  • geoElements — A List of objects that implement the GeoElement. Contents of the List will be copied.
  • fields — A List of type Field. Contents of the List will be copied. Can be null.

Implementation

factory FeatureCollectionTable.withGeoElements(
    {required List<GeoElement> geoElements, required List<Field> fields}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreGeoElements =
      geoElements.toMutableArray(valueType: _ElementType.variant);
  final coreFields = fields.toMutableArray(valueType: _ElementType.field);
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_FeatureCollectionTable_createWithGeoElements(
        coreGeoElements._handle, coreFields._handle, errorHandler);
  });
  final FeatureCollectionTable object =
      FeatureTable._instanceCache.instanceWith(handle);
  object._fields.value.setCache(fields);
  return object;
}