Polygon.fromJson constructor

Polygon.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Polygon.fromJson(Map<String, dynamic> json) {
  return Polygon(
    id: json['id'],
    points: (json['points'] as List).map((e) => LatLng.fromJson(e)).toList(),
    holes: (json['holes'] as List)
        .map((e) => (e as List).map((e) => LatLng.fromJson(e)).toList())
        .toList(),
    fillColor: json['fillColor'] != null
        ? Color(int.parse(json['fillColor'].toString()))
        : null,
    strokeColor: json['strokeColor'] != null
        ? Color(int.parse(json['strokeColor'].toString()))
        : null,
    alpha: json['alpha']?.toDouble(),
  );
}