size property

Size? size
final

Sets the size for the marker on the map.

Defaults to Size(14.0, 14.0).

If child is given, then the size of the child will be the size of the marker.

late List<Model> data;
late MapShapeSource _mapSource;

@override
void initState() {
   data = const <Model>[
     Model('Brazil', -14.235004, -51.92528),
     Model('Germany', 51.16569, 10.451526),
     Model('Australia', -25.274398, 133.775136),
     Model('India', 20.593684, 78.96288),
     Model('Russia', 61.52401, 105.318756)
   ];

   _mapSource = MapShapeSource.asset(
     'assets/world_map.json',
     shapeDataField: 'name',
     dataCount: data.length,
     primaryValueMapper: (int index) => data[index].country,
   );
   super.initState();
}

@override
Widget build(BuildContext context) {
   return Scaffold(
     body: Center(
         child: Container(
           height: 350,
           child: Padding(
             padding: EdgeInsets.only(left: 15, right: 15),
             child: SfMaps(
               layers: <MapLayer>[
                 MapShapeLayer(
                   source: _mapSource,
                   initialMarkersCount: 5,
                   markerBuilder: (BuildContext context, int index) {
                     return MapMarker(
                       latitude: data[index].latitude,
                       longitude: data[index].longitude,
                       size: Size(18, 18),
                     );
                   },
                 ),
               ],
             ),
           ),
         )
     ),
   );
 }

class Model {
 const Model(this.country, this.latitude, this.longitude);

 final String country;
 final double latitude;
 final double longitude;
}

See also:

Implementation

final Size? size;