createFeature method

Feature createFeature(
  1. {Map<String, dynamic> attributes = const {},
  2. Geometry? geometry}
)

Creates a new feature with the provided attribute values and, optionally, geometry.

The new feature is only available in memory at this point. Execute FeatureTable.addFeature to commit the new Feature to the table.

Parameters:

  • attributes — The attributes.
  • geometry — The geometry.

Return Value: A Feature.

Implementation

Feature createFeature(
    {Map<String, dynamic> attributes = const {}, Geometry? geometry}) {
  final coreAttributes = attributes.toDictionary(
      keyType: _ElementType.string, valueType: _ElementType.variant);
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_FeatureTable_createFeatureWithAttributes(
        _handle,
        coreAttributes._handle,
        geometry?._handle ?? ffi.nullptr,
        errorHandler);
  });
  return Feature._fromHandle(objectHandle)!;
}