bubbleSizeMapper property

IndexedDoubleValueMapper? bubbleSizeMapper
final

Returns a value based on which bubble size will be calculated.

The minimum and maximum size of the bubble can be customized using the MapBubbleSettings.minRadius and MapBubbleSettings.maxRadius.

late List<Model> _data;
late MapShapeSource _mapSource;

@override
void initState() {
  _data = <Model>[
   Model('India', 280, "Low"),
   Model('United States of America', 190, "High"),
   Model('Pakistan', 37, "Low"),
  ];

  _mapSource = MapShapeSource.asset(
    "assets/world_map.json",
    shapeDataField: "name",
    dataCount: _data.length,
    primaryValueMapper: (int index) {
      return _data[index].country;
    },
    bubbleSizeMapper: (int index) {
      return _data[index].usersCount;
    }
  );

  super.initState();
}

 @override
Widget build(BuildContext context) {
  return SfMaps(
    layers: [
      MapShapeLayer(
          source: _mapSource,
      )
    ],
  );
}

class Model {
 const Model(this.country, this.usersCount, this.storage);

 final String country;
 final double usersCount;
 final String storage;
}

Implementation

final IndexedDoubleValueMapper? bubbleSizeMapper;