passo_mobile_app/lib/model/login_data/user_info/role.dart

74 lines
1.8 KiB
Dart

import 'assigned_area.dart';
import 'module.dart';
class Role {
Role({
this.id,
this.name,
this.modules,
this.assignedArea,
});
int? id;
String? name;
List<Module?>? modules;
List<AssignedArea?>? assignedArea;
factory Role.fromJson(Map<String, dynamic> json) => Role(
id: json["id"],
name: json["name"],
modules: json["modules"] == null
? []
: List<Module?>.from(
json["modules"]!.map((x) => Module.fromJson(x))),
assignedArea: json["assigned_area"] == null
? []
: json["assigned_area"] == null
? []
: List<AssignedArea?>.from(json["assigned_area"]!
.map((x) => AssignedArea.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"modules": modules == null
? []
: List<dynamic>.from(modules!.map((x) => x!.toJson())),
"assigned_area": assignedArea == null
? []
: assignedArea == null
? []
: List<dynamic>.from(assignedArea!.map((x) => x!.toJson())),
};
}class Object {
Object({
this.id,
this.name,
this.slug,
this.operations,
});
int? id;
String? name;
String? slug;
List<String?>? operations;
factory Object.fromJson(Map<String, dynamic> json) => Object(
id: json["id"],
name: json["name"],
slug: json["slug"],
operations: json["operations"] == null
? []
: List<String?>.from(json["operations"]!.map((x) => x)),
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"slug": slug,
"operations": operations == null
? []
: List<dynamic>.from(operations!.map((x) => x)),
};
}