oc-front/lib/models/workspace.dart

29 lines
868 B
Dart
Raw Normal View History

import 'package:oc_front/models/abstract.dart';
class Workspace extends SerializerDeserializer<Workspace> {
String? id;
List<dynamic> data;
List<dynamic> datacenter;
List<dynamic> storage;
List<dynamic> computing;
Workspace({
this.id,
this.computing = const [],
this.data = const [],
this.datacenter = const [],
this.storage = const [],
});
@override deserialize(dynamic json) {
try { json = json as Map<String, dynamic>;
} catch (e) { return Workspace(); }
return Workspace(
computing: json.containsKey("computing") ? json["computing"] : [],
datacenter: json.containsKey("datacenter") ? json["datacenter"] : [],
data: json.containsKey("data") ? json["data"] : [],
storage: json.containsKey("storage") ? json["storage"] : [],
);
}
@override Map<String, dynamic> serialize() => {};
}