Feature<T extends Geometry> constructor

const Feature<T extends Geometry>({
  1. Object? id,
  2. Map<String, Object?>? properties,
  3. T? geometry,
  4. Bounds<Point<num>>? bounds,
})

A new feature of optional id, properties, geometry and bounds.

The id should be null, int, BigInt or String. Other types not allowed.

The properties is used as a reference. Any changes on source reflect also on feature properties.

If an optional bounds for a new feature is not provided then geometry bounds is used also as feature bounds when accessed.

Implementation

const Feature({
  Object? id,
  Map<String, Object?>? properties,
  T? geometry,
  Bounds? bounds,
})  : assert(
        id == null || id is String || id is int || id is BigInt,
        'Id should be null, int, BigInt or String',
      ),
      _id = id,
      _properties = properties,
      _geometry = geometry,
      _featureBounds = bounds;