NeshanPolyline class

A model representing a polyline (line/path) on a Neshan map.

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

Usage Example

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

// Solid line
final solidLine = NeshanPolyline(
  id: 'route1',
  coordinates: [
    LatLng(35.700, 51.400),
    LatLng(35.710, 51.410),
    LatLng(35.720, 51.420),
  ],
  color: Colors.red,
  width: 5,
  isDashed: false,
);

// Dashed line
final dashedLine = NeshanPolyline(
  id: 'route2',
  coordinates: [
    LatLng(35.700, 51.400),
    LatLng(35.710, 51.410),
    LatLng(35.720, 51.420),
  ],
  color: Colors.blue,
  width: 4,
  isDashed: true,
);

Constructors

NeshanPolyline({required String id, required List<LatLng> coordinates, Color? color, double width = 3.0, double opacity = 1.0, bool isDashed = false})
Creates a new polyline.
const

Properties

color → Color?
The color of the line.
final
coordinates → List<LatLng>
The list of coordinates that define the line path.
final
hashCode → int
The hash code for this object.
no setteroverride
id → String
Unique identifier for the polyline.
final
isDashed → bool
Whether the line is dashed or solid.
final
opacity → double
The opacity of the line.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
width → double
The width of the line in pixels.
final

Methods

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

Operators

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