first commit
This commit is contained in:
34
lib/models/model/locations.dart
Normal file
34
lib/models/model/locations.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
class CarLocationModel {
|
||||
String id;
|
||||
String driverId;
|
||||
double latitude;
|
||||
double heading;
|
||||
double speed;
|
||||
double longitude;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
|
||||
CarLocationModel({
|
||||
required this.id,
|
||||
required this.driverId,
|
||||
required this.latitude,
|
||||
required this.longitude,
|
||||
required this.heading,
|
||||
required this.speed,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
factory CarLocationModel.fromJson(Map<String, dynamic> json) {
|
||||
return CarLocationModel(
|
||||
id: json['id'],
|
||||
driverId: json['driver_id'],
|
||||
latitude: double.parse(json['latitude'].toString()),
|
||||
longitude: double.parse(json['longitude'].toString()),
|
||||
heading: double.parse(json['heading'].toString()),
|
||||
speed: double.parse(json['speed'].toString()),
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user