MapArc class Null safety

Creates an arc by connecting the two geographical coordinates.

 late List<Model> _arcs;
 late MapZoomPanBehavior _zoomPanBehavior;
 late MapShapeSource _mapSource;

 @override
 void initState() {
   _zoomPanBehavior = MapZoomPanBehavior(
     focalLatLng: MapLatLng(40.7128, -95.3698),
     zoomLevel: 3,
   );

  _mapSource = MapShapeSource.asset(
     "assets/world_map.json",
     shapeDataField: "continent",
   );

  _arcs = <Model>[
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(44.9778, -93.2650)),
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(33.4484, -112.0740)),
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(29.7604, -95.3698)),
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(39.7392, -104.9903)),
   ];
 super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     body: SfMaps(
       layers: [
         MapShapeLayer(
           source: _mapSource,
           zoomPanBehavior: _zoomPanBehavior,
           sublayers: [
             MapArcLayer(
               arcs: List<MapArc>.generate(
                 _arcs.length,
                 (int index) {
                   return MapArc(
                     from: _arcs[index].from,
                     to: _arcs[index].to,
                   );
                 },
               ).toSet(),
             ),
           ],
         ),
       ],
     ),
   );
 }

class Model {
  Model(this.from, this.to);

  MapLatLng from;
  MapLatLng to;
}
Inheritance

Constructors

MapArc({required MapLatLng from, required MapLatLng to, double heightFactor = 0.2, double controlPointFactor = 0.5, List<double>? dashArray, Color? color, double? width, VoidCallback? onTap})
Creates a MapArc.
const

Properties

color Color?
Color of the arc. [...]
final
controlPointFactor double
Specifies the arc bending position. [...]
final
dashArray List<double>?
Apply dash pattern for the arc. [...]
final
from MapLatLng
Represents the start coordinate of an arc. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
heightFactor double
Specifies the distance from the line connecting two points to the arc bend point. [...]
final
onTap VoidCallback?
Callback to receive tap event for this arc. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
to MapLatLng
Represents the end coordinate of an arc. [...]
final
width double?
Width of the arc. [...]
final

Methods

debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited