layers property

List<MapLayer> layers
final

The collection of map shape layer in which geographical rendering is done.

The snippet below shows how to render the basic world map using the data from .json file.

  @override
 Widget build(BuildContext context) {
   return SfMaps(
     layers: [
       MapShapeLayer(
         source: MapShapeSource.asset(
             "assets/world_map.json",
             shapeDataField: "name",
          ),
       )
     ],
   );
 }

See also:

  • MapShapeLayer.source, to provide data for the elements of the SfMaps like data labels, bubbles, tooltip, shape colors, and legend.

Implementation

final List<MapLayer> layers;