toDictionary method
Converts this user to a dictionary
Implementation
Map<String, dynamic> toDictionary() {
Map<String, dynamic> dictionary = {
'id': id,
'name': name,
'surname': surname,
'email': email,
'phone': phone,
'image': imageUrl,
'auth_mode': authModeToString(authMode),
};
if(data != null){
if (data is Map<String, dynamic>) {
dictionary['data'] = data;
}
}
if (contracts != null) {
dictionary['contracts'] =
contracts!.map((c) => c.toDictionary()).toList();
}
return dictionary;
}