PathModel.fromJson constructor

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

Creates a PathModel from previously serialized JSON data.

Implementation

factory PathModel.fromJson(Map<String, dynamic> json) {
  return PathModel(
    path:
        (json['path'] as List)
            .map((e) => LatLng(e['lat'], e['lng']))
            .toList(),
    distance: (json['distance'] as num).toDouble(),
    timestamp: DateTime.parse(json['timestamp']),
    customPoints:
        (json['customPoints'] as List)
            .map((e) => LatLng(e['lat'], e['lng']))
            .toList(),
  );
}