astronote/lib/models/datas.dart

33 lines
917 B
Dart
Raw Normal View History

2020-07-31 17:30:32 +02:00
import 'package:astronote_app/models/companies.dart';
class Datas {
String lastname;
List<Companies> companies;
String firstname;
String civilite;
Datas({this.lastname, this.companies, this.firstname, this.civilite});
Datas.fromJson(Map<String, dynamic> json) {
lastname = json['lastname'];
if (json['companies'] != null) {
companies = new List<Companies>();
json['companies'].forEach((v) {
companies.add(new Companies.fromJson(v));
});
}
firstname = json['firstname'];
civilite = json['civilite'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['lastname'] = this.lastname;
if (this.companies != null) {
data['companies'] = this.companies.map((v) => v.toJson()).toList();
}
data['firstname'] = this.firstname;
data['civilite'] = this.civilite;
return data;
}
}