from property

double from
final

Sets the range start for the color mapping.

The shape or bubble will render in the specified color if the value returned in the MapShapeLayerDelegate.shapeColorValueMapper or MapShapeLayerDelegate.bubbleColorValueMapper falls between the from and to range.

List<Model> data;

 @override
 void initState() {
   super.initState();

   data = <Model>[
    Model('India', 100, "Low"),
    Model('United States of America', 200, "High"),
    Model('Pakistan', 75, "Low"),
   ];
 }

 @override
 Widget build(BuildContext context) {
   return SfMaps(
     layers: [
       MapShapeLayer(
         delegate: MapShapeLayerDelegate(
             shapeFile: "assets/world_map.json",
             shapeDataField: "name",
             dataCount: data.length,
             primaryValueMapper: (index) {
               return data[index].country;
             },
             shapeColorValueMapper: (index) {
               return data[index].count;
             },
             shapeColorMappers: [
               MapColorMapper(from: 0, to:  100, color: Colors.red),
               MapColorMapper(from: 101, to: 200, color: Colors.yellow)
            ]),
       )
     ],
   );
 }

See also:

Implementation

final double from