mirror of
https://github.com/inventree/inventree-app.git
synced 2025-12-22 20:13:13 +00:00
Fixes for type casting
This commit is contained in:
@@ -27,21 +27,21 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
|
||||
InvenTreeCompany() : super();
|
||||
|
||||
String get image => jsondata['image'] ?? jsondata['thumbnail'] ?? InvenTreeAPI.staticImage;
|
||||
String get image => (jsondata['image'] ?? jsondata['thumbnail'] ?? InvenTreeAPI.staticImage) as String;
|
||||
|
||||
String get thumbnail => jsondata['thumbnail'] ?? jsondata['image'] ?? InvenTreeAPI.staticThumb;
|
||||
String get thumbnail => (jsondata['thumbnail'] ?? jsondata['image'] ?? InvenTreeAPI.staticThumb) as String;
|
||||
|
||||
String get website => jsondata['website'] ?? '';
|
||||
String get website => (jsondata['website'] ?? '') as String;
|
||||
|
||||
String get phone => jsondata['phone'] ?? '';
|
||||
String get phone => (jsondata['phone'] ?? '') as String;
|
||||
|
||||
String get email => jsondata['email'] ?? '';
|
||||
String get email => (jsondata['email'] ?? '') as String;
|
||||
|
||||
bool get isSupplier => jsondata['is_supplier'] ?? false;
|
||||
bool get isSupplier => (jsondata['is_supplier'] ?? false) as bool;
|
||||
|
||||
bool get isManufacturer => jsondata['is_manufacturer'] ?? false;
|
||||
bool get isManufacturer => (jsondata['is_manufacturer'] ?? false) as bool;
|
||||
|
||||
bool get isCustomer => jsondata['is_customer'] ?? false;
|
||||
bool get isCustomer => (jsondata['is_customer'] ?? false) as bool;
|
||||
|
||||
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@@ -85,27 +85,27 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
|
||||
int get manufacturerId => (jsondata['manufacturer'] ?? -1) as int;
|
||||
|
||||
String get manufacturerName => jsondata['manufacturer_detail']['name'];
|
||||
String get manufacturerName => (jsondata['manufacturer_detail']['name'] ?? '') as String;
|
||||
|
||||
String get manufacturerImage => jsondata['manufacturer_detail']['image'] ?? jsondata['manufacturer_detail']['thumbnail'];
|
||||
String get manufacturerImage => (jsondata['manufacturer_detail']['image'] ?? jsondata['manufacturer_detail']['thumbnail'] ?? InvenTreeAPI.staticThumb) as String;
|
||||
|
||||
int get manufacturerPartId => (jsondata['manufacturer_part'] ?? -1) as int;
|
||||
|
||||
int get supplierId => (jsondata['supplier'] ?? -1) as int;
|
||||
|
||||
String get supplierName => jsondata['supplier_detail']['name'];
|
||||
String get supplierName => (jsondata['supplier_detail']['name'] ?? '') as String;
|
||||
|
||||
String get supplierImage => jsondata['supplier_detail']['image'] ?? jsondata['supplier_detail']['thumbnail'];
|
||||
String get supplierImage => (jsondata['supplier_detail']['image'] ?? jsondata['supplier_detail']['thumbnail'] ?? InvenTreeAPI.staticThumb) as String;
|
||||
|
||||
String get SKU => (jsondata['SKU'] ?? '') as String;
|
||||
|
||||
String get MPN => jsondata['MPN'] ?? '';
|
||||
String get MPN => (jsondata['MPN'] ?? '') as String;
|
||||
|
||||
int get partId => jsondata['part'] ?? -1;
|
||||
int get partId => (jsondata['part'] ?? -1) as int;
|
||||
|
||||
String get partImage => jsondata["part_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb;
|
||||
String get partImage => (jsondata["part_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
|
||||
|
||||
String get partName => jsondata["part_detail"]["full_name"] ?? "";
|
||||
String get partName => (jsondata["part_detail"]["full_name"] ?? '') as String;
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
|
||||
Reference in New Issue
Block a user