fromJson static method

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

Implementation

static Location? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return Location(
    latitude: ((json['latitude'] as num?) ?? 0.0).toDouble(),
    longitude: ((json['longitude'] as num?) ?? 0.0).toDouble(),
    horizontalAccuracy: ((json['horizontal_accuracy'] as num?) ?? 0.0)
        .toDouble(),
  );
}