class Flight { int? id; String name; // Timestamp in seconds since epoch int startTimestamp; int endTimestamp; // Foreign keys int droneId; int batteryId; // Location double? locationLat; double? locationLong; Flight({ this.id, required this.name, required this.startTimestamp, required this.endTimestamp, required this.droneId, required this.batteryId, this.locationLat, this.locationLong, }); factory Flight.fromMap(Map map) => Flight( id: map["id"], name: map["name"], startTimestamp: map["start_timestamp"], endTimestamp: map["end_timestamp"], droneId: map["drone_id"], batteryId: map["batteryId"], locationLat: map["location_lat"], locationLong: map["location_long"], ); Map toMap() { return { "id": id, "name": name, "start_timestamp": startTimestamp, "end_timestamp": endTimestamp, "drone_id": droneId, "battery_id": batteryId, "location_lat": locationLat, "location_long": locationLong, }; } }