Initial commit of Flutter project
This commit is contained in:
42
lib/models/service_boy_response.dart
Normal file
42
lib/models/service_boy_response.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
import 'package:glowwheels/models/service_boy_response.dart';
|
||||
import 'package:glowwheels/models/serviceboy_model.dart';
|
||||
|
||||
class ServiceBoyResponse {
|
||||
final String id;
|
||||
final String shopId;
|
||||
final List<ServiceBoy> serviceBoy;
|
||||
final String createdAt;
|
||||
final String updatedAt;
|
||||
|
||||
ServiceBoyResponse({
|
||||
required this.id,
|
||||
required this.shopId,
|
||||
required this.serviceBoy,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
factory ServiceBoyResponse.fromJson(Map<String, dynamic> json) {
|
||||
return ServiceBoyResponse(
|
||||
id: json['_id'],
|
||||
shopId: json['shopId'],
|
||||
serviceBoy: (json['serviceBoy'] as List)
|
||||
.map((e) => ServiceBoy.fromJson(e))
|
||||
.toList(),
|
||||
createdAt: json['createdAt'],
|
||||
updatedAt: json['updatedAt'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'_id': id,
|
||||
'shopId': shopId,
|
||||
'serviceBoy': serviceBoy.map((e) => e.toJson()).toList(),
|
||||
'createdAt': createdAt,
|
||||
'updatedAt': updatedAt,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user