fromMap static method

AMapLocation? fromMap(
  1. dynamic json
)

Implementation

static AMapLocation? fromMap(dynamic json) {
  if (null == json) {
    return null;
  }

  final LatLng? latLng = LatLng.fromJson(json['latLng']);
  if (latLng == null) {
    return null;
  }

  return AMapLocation(
    provider: json['provider'] ?? '',
    latLng: latLng,
    accuracy: (json['accuracy'] as num?)?.toDouble() ?? 0,
    altitude: (json['altitude'] as num?)?.toDouble() ?? 0,
    bearing: (json['bearing'] as num?)?.toDouble() ?? 0,
    speed: (json['speed'] as num?)?.toDouble() ?? 0,
    time: json['time'] ?? 0,
  );
}