25 lines
506 B
Dart
25 lines
506 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'car_dto.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class CarDTO {
|
|
@JsonKey(name: 'id')
|
|
final int id;
|
|
|
|
@JsonKey(name: 'driver_name')
|
|
final String? driverName;
|
|
|
|
@JsonKey(name: 'car_name')
|
|
final String carName;
|
|
|
|
CarDTO({
|
|
required this.id,
|
|
required this.carName,
|
|
required this.driverName,
|
|
});
|
|
|
|
factory CarDTO.fromJson(Map<String, dynamic> json) => _$CarDTOFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$CarDTOToJson(this);
|
|
} |