Initial draft
This commit is contained in:
20
lib/dto/car_add.dart
Normal file
20
lib/dto/car_add.dart
Normal file
@ -0,0 +1,20 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'car_add.g.dart';
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class CarAddDTO {
|
||||
CarAddDTO(
|
||||
{required this.teamId,
|
||||
required this.plate});
|
||||
|
||||
final int teamId;
|
||||
final String plate;
|
||||
|
||||
factory CarAddDTO.fromJson(Map<String, dynamic> json) => _$CarAddDTOFromJson(json);
|
||||
factory CarAddDTO.make(int teamID, String plate) {
|
||||
Map<String, dynamic> data = {"team_id": teamID, "plate": plate};
|
||||
return CarAddDTO.fromJson(data);
|
||||
}
|
||||
Map<dynamic, dynamic> toJson() => _$CarAddDTOToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user