|
14 | 14 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
15 | 15 |
|
16 | 16 | import 'package:woosignal/models/image.dart'; |
| 17 | +import 'package:woosignal/models/response/dimension.dart'; |
17 | 18 |
|
18 | 19 | import '../meta_data.dart'; |
19 | 20 |
|
@@ -174,7 +175,9 @@ class Product { |
174 | 175 | backordersAllowed = json['backorders_allowed'], |
175 | 176 | backordered = json['backordered'], |
176 | 177 | soldIndividually = json['sold_individually'], |
177 | | - weight = json['weight'], |
| 178 | + weight = (json['weight'] is double |
| 179 | + ? json['weight'].toString() |
| 180 | + : json['weight']), |
178 | 181 | dimensions = Dimension.fromJson(json['dimensions']), |
179 | 182 | shippingRequired = json['shipping_required'], |
180 | 183 | shippingTaxable = json['shipping_taxable'], |
@@ -257,22 +260,6 @@ class Category { |
257 | 260 | }; |
258 | 261 | } |
259 | 262 |
|
260 | | -class Dimension { |
261 | | - final String? length; |
262 | | - final String? width; |
263 | | - final String? height; |
264 | | - |
265 | | - Dimension(this.length, this.height, this.width); |
266 | | - |
267 | | - Dimension.fromJson(Map<String, dynamic> json) |
268 | | - : length = json['length'], |
269 | | - width = json['width'], |
270 | | - height = json['height']; |
271 | | - |
272 | | - Map<String, dynamic> toJson() => |
273 | | - {'length': length, 'width': width, 'height': height}; |
274 | | -} |
275 | | - |
276 | 263 | class Attribute { |
277 | 264 | final int? id; |
278 | 265 | final String? name; |
|
0 commit comments