$new static method

$Value? $new(
  1. Runtime runtime,
  2. $Value? thisValue,
  3. List<$Value?> args
)

Wrapper for the GeoJsonLayer.new constructor

Implementation

static $Value? $new(Runtime runtime, $Value? thisValue, List<$Value?> args) {
  return $GeoJsonLayer.wrap(
    GeoJsonLayer(
      key: args[0]?.$value,
      data: args[1]!.$value,
      onPoint: (LatLng point, Map<String, dynamic> properties) {
        return (args[2]! as EvalCallable?)?.call(runtime, null, [
          $LatLng.wrap(point),
          $Map.wrap(properties),
        ])?.$value;
      },
      onPolyline: (List<LatLng> points, Map<String, dynamic> properties) {
        return (args[3]! as EvalCallable?)?.call(runtime, null, [
          $List.view(points, (e) => $LatLng.wrap(e)),
          $Map.wrap(properties),
        ])?.$value;
      },
      onPolygon:
          (
            List<LatLng> points,
            List<List<LatLng>>? holes,
            Map<String, dynamic> properties,
          ) {
            return (args[4]! as EvalCallable?)?.call(runtime, null, [
              $List.view(points, (e) => $LatLng.wrap(e)),
              if (holes == null)
                const $null()
              else
                $List.view(
                  holes,
                  (e) => $List.view(e, (e) => $LatLng.wrap(e)),
                ),
              $Map.wrap(properties),
            ])?.$value;
          },
      filter: (String geometryType, Map<String, dynamic> properties) {
        return (args[5]! as EvalCallable?)?.call(runtime, null, [
          $String(geometryType),
          $Map.wrap(properties),
        ])?.$value;
      },
      styleDefaults: args[6]?.$value,
      hitNotifier: args[7]?.$value,
      polylineHitbox: args[8]?.$value ?? 10,
    ),
  );
}