Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
737 B
1
Indexable
Never
import 'dart:core';


class PointOfInterest {
  final int poiId;
  String name;
  double latitude;
  double longitude;
  // Set<Student> likedByStudents = new HashSet<Student>();


  PointOfInterest({
    required this.poiId,
    required this.name,
    required this.latitude,
    required this.longitude
  });

  factory PointOfInterest.fromJson(Map poiMap){

    return PointOfInterest(
        poiId:poiMap ['poiID'],
        name: poiMap['name'],
        latitude: (poiMap['latitude'] as num).toDouble(),
        longitude: (poiMap['longitude'] as num).toDouble(),
    );
  }
  Map toJson() =>{
    "poiID" : poiId,
    'name' : name,
    'latitude' : latitude,
    "longitude" : longitude,
  };
}
Leave a Comment