text property

String? text

Specifies the text to be used for the legend item.

By default, MapColorMapper.from and MapColorMapper.to or MapColorMapper.value will be used as the text of the legend item.

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;
     shapeColorValueMapper: (int index) {
        return _data[index].storage;
     shapeColorMappers: [
        MapColorMapper(value: "Low", color: Colors.red, text: 'Low+'),
        MapColorMapper(value: "High", color: Colors.green, text: 'High+')

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

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

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

See also:


final String? text;