primaryValueMapper property

IndexedStringValueMapper? primaryValueMapper

Returns the the primary value for the every data in the data source collection.

This primary value will be mapped with the shapeDataField value in the respective shape detail in the .json file. This mapping will then be used in the rendering of bubbles, data labels, shape colors, tooltip in their respective shape's coordinates.

late List<Model> _data;
late MapShapeSource _mapSource;

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

  _mapSource = MapShapeSource.asset(
    shapeDataField: "name",
    dataCount: _data.length,
    primaryValueMapper: (int index) {
      return _data[index].country;


Widget build(BuildContext context) {
  return SfMaps(
    layers: [
        source: _mapSource,

class Model {
 const Model(, this.count,;

 final String country;
 final double count;
 final String storage;


final IndexedStringValueMapper? primaryValueMapper;