68 lines
1.4 KiB
Dart
68 lines
1.4 KiB
Dart
|
class Module {
|
||
|
Module({
|
||
|
this.id,
|
||
|
this.icon,
|
||
|
this.name,
|
||
|
this.slug,
|
||
|
this.objects,
|
||
|
});
|
||
|
|
||
|
int? id;
|
||
|
String? icon;
|
||
|
String? name;
|
||
|
String? slug;
|
||
|
List<Object?>? objects;
|
||
|
|
||
|
factory Module.fromJson(Map<String, dynamic> json) => Module(
|
||
|
id: json["id"],
|
||
|
icon: json["icon"],
|
||
|
name: json["name"],
|
||
|
slug: json["slug"],
|
||
|
objects: json["objects"] == null
|
||
|
? []
|
||
|
: List<Object?>.from(
|
||
|
json["objects"]!.map((x) => Object.fromJson(x))),
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"icon": icon,
|
||
|
"name": name,
|
||
|
"slug": slug,
|
||
|
"objects": objects == null
|
||
|
? []
|
||
|
: List<dynamic>.from(objects!.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)),
|
||
|
};
|
||
|
}
|