You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/models/new_models/floor.dart

49 lines
1.0 KiB
Dart

import 'package:test_sa/models/new_models/department.dart';
class Floor {
Floor({
this.id,
this.name,
this.value,
this.departments,
});
Floor.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
value = json['value'];
if (json['departments'] != null) {
departments = [];
json['departments'].forEach((v) {
departments.add(Department.fromJson(v));
});
}
}
num id;
String name;
num value;
List<Department> departments;
Floor copyWith({
num id,
String name,
num value,
List<Department> departments,
}) =>
Floor(
id: id ?? this.id,
name: name ?? this.name,
value: value ?? this.value,
departments: departments ?? this.departments,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['value'] = value;
if (departments != null) {
map['departments'] = departments.map((v) => v.toJson()).toList();
}
return map;
}
}