MapShapeSource.memory constructor
const
MapShapeSource.memory(
- Uint8List bytes, {
- String? shapeDataField,
- int dataCount = 0,
- IndexedStringValueMapper? primaryValueMapper,
- List<
MapColorMapper> ? shapeColorMappers, - List<
MapColorMapper> ? bubbleColorMappers, - IndexedStringValueMapper? dataLabelMapper,
- IndexedDoubleValueMapper? bubbleSizeMapper,
- IndexedColorValueMapper? shapeColorValueMapper,
- IndexedColorValueMapper? bubbleColorValueMapper,
Creates a layer using the GeoJSON source as bytes from Uint8List.
late MapShapeSource _mapSource;
@override
void initState() {
_mapSource = MapShapeSource.memory(
bytes,
shapeDataField: 'name'
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Memory sample'),
),
body: Center(
child: SfMaps(
layers: [
MapShapeLayer(
source: _mapSource,
showDataLabels: true,
color: Colors.orange[100],
),
],
)),
);
}
Implementation
const MapShapeSource.memory(
Uint8List bytes, {
this.shapeDataField,
this.dataCount = 0,
this.primaryValueMapper,
this.shapeColorMappers,
this.bubbleColorMappers,
this.dataLabelMapper,
this.bubbleSizeMapper,
this.shapeColorValueMapper,
this.bubbleColorValueMapper,
}) : _path = bytes,
_type = GeoJSONSourceType.memory,
assert((primaryValueMapper != null && dataCount > 0) ||
primaryValueMapper == null),
assert((shapeColorMappers != null &&
primaryValueMapper != null &&
shapeColorValueMapper != null) ||
shapeColorMappers == null),
assert((bubbleColorMappers != null &&
primaryValueMapper != null &&
bubbleColorValueMapper != null) ||
bubbleColorMappers == null);