toJson method
Converts the RoleModel to JSON for API requests.
Implementation
Map<String, dynamic> toJson() {
final json = <String, dynamic>{
'title': title,
'default': isDefault,
'admin': admin,
};
if (id != null) {
json['_id'] = id!;
}
if (description != null) {
json['description'] = description!;
}
return json;
}