Adds flight,battery models and image file managment
This commit is contained in:
51
lib/models/flight.dart
Normal file
51
lib/models/flight.dart
Normal file
@ -0,0 +1,51 @@
|
||||
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<String, dynamic> 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<String, dynamic> toMap() {
|
||||
return {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"start_timestamp": startTimestamp,
|
||||
"end_timestamp": endTimestamp,
|
||||
"drone_id": droneId,
|
||||
"battery_id": batteryId,
|
||||
"location_lat": locationLat,
|
||||
"location_long": locationLong,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user