Amélioration page ship
This commit is contained in:
@@ -58,15 +58,22 @@ class Inventory {
|
||||
class Cargo {
|
||||
int? capacity;
|
||||
int? units;
|
||||
//List<Inventory>? inventory;
|
||||
List<Inventory>? inventory;
|
||||
|
||||
Cargo({this.capacity, this.units});//, this.inventory});
|
||||
Cargo({this.capacity, this.units, this.inventory});
|
||||
|
||||
factory Cargo.fromJson(Map<String, dynamic> json) {
|
||||
var inventoryList = json['inventory'] as List<dynamic>?;
|
||||
List<Inventory>? parsedInventoryList;
|
||||
if (inventoryList != null) {
|
||||
parsedInventoryList = inventoryList
|
||||
.map((item) => Inventory.fromJson(item))
|
||||
.toList();
|
||||
}
|
||||
return Cargo(
|
||||
capacity: json['capacity'],
|
||||
units: json['units'],
|
||||
//inventory: json.decode(json['inventory']),
|
||||
inventory: parsedInventoryList,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user