NeshanPolygon class

A model representing a polygon on a Neshan map.

This class encapsulates all the properties needed to display a polygon using Mapbox GL JS GeoJSON sources and fill layers.

Usage Example

import 'package:flutter/material.dart';
import 'package:latlong2/latlong.dart';
import 'package:neshan_maps_flutter/map.dart';

final polygon = NeshanPolygon(
  id: 'area1',
  coordinates: [
    LatLng(35.700, 51.400),
    LatLng(35.710, 51.410),
    LatLng(35.720, 51.400),
    LatLng(35.700, 51.400),
  ],
  fillColor: Colors.blue.withOpacity(0.3),
  strokeColor: Colors.blue,
  strokeWidth: 2,
);

Constructors

NeshanPolygon({required String id, required List<LatLng> coordinates, Color? fillColor, double fillOpacity = 0.5, Color? strokeColor, double strokeWidth = 2.0, double strokeOpacity = 1.0})
Creates a new polygon.
const

Properties

coordinates List<LatLng>
The list of coordinates that define the polygon boundary.
final
fillColor Color?
Optional fill color for the polygon.
final
fillOpacity double
The opacity of the polygon fill.
final
hashCode int
The hash code for this object.
no setteroverride
id String
Unique identifier for the polygon.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strokeColor Color?
Optional stroke (outline) color for the polygon.
final
strokeOpacity double
The opacity of the polygon outline.
final
strokeWidth double
The width of the polygon outline in pixels.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this polygon to a JSON object for serialization.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override