MapArcLayer class Null safety

A sublayer which renders group of MapArc on MapShapeLayer and MapTileLayer.

 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;
}

See also:

Inheritance

Constructors

MapArcLayer({Key? key, required Set<MapArc> arcs, Animation<double>? animation, Color? color, double width = 2, List<double> dashArray = const <double>[0, 0], IndexedWidgetBuilder? tooltipBuilder})
Creates the MapArcLayer.
const

Properties

animation Animation<double>?
Animation for the arcs in MapArcLayer. [...]
final
arcs Set<MapArc>
A collection of MapArc. [...]
final
color Color?
The color of all the arcs. [...]
final
dashArray List<double>
Apply same dash pattern for all the MapArc in the arcs collection. [...]
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
tooltipBuilder IndexedWidgetBuilder?
Returns a widget for the map line tooltip based on the index. [...]
final, inherited
width double
The width of all the arcs. [...]
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree. [...]
inherited
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 short, textual description of this widget.
inherited

Operators

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