AMapGeoFenceModel.fromMap constructor

AMapGeoFenceModel.fromMap(
  1. Map json
)

Implementation

AMapGeoFenceModel.fromMap(Map<dynamic, dynamic> json) {
  pointList = <List<LatLng>>[];
  final points = json['pointList'];
  if (points is List) {
    for (var v in points) {
      final points = v as List<dynamic>;
      pointList!.add(points
          .map((dynamic e) => LatLng.fromMap(e as Map<dynamic, dynamic>))
          .toList());
    }
  }
  center = json['center'] != null
      ? LatLng.fromMap(json['center'] as Map<dynamic, dynamic>)
      : null;
  poiItem = json['poiItem'] != null
      ? AMapPoiItemModel.fromMap(json['poiItem'] as Map<dynamic, dynamic>)
      : null;
  radius = json['radius'] as double?;
  customID = json['customID'] as String?;
  fenceID = json['fenceID'] as String?;
  final statusInt = json['status'] as int?;
  if (statusInt != null && statusInt < 4) {
    status = GenFenceStatus.values[statusInt];
  }
  final typeInt = json['type'] as int?;
  if (typeInt != null && typeInt < 4) type = GenFenceType.values[typeInt];
}