backup. before shop update
This commit is contained in:
41
lib/models/product_attribute.dart
Normal file
41
lib/models/product_attribute.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'product_option.dart';
|
||||
|
||||
class ProductAttribute {
|
||||
int id;
|
||||
String name;
|
||||
List<ProductOption> productOptions;
|
||||
bool singleSelection;
|
||||
bool byQuantity;
|
||||
bool required;
|
||||
String extra;
|
||||
bool disabled;
|
||||
|
||||
ProductAttribute.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
name = json['name'],
|
||||
productOptions = (json['productoptions'] as List).map((i) => ProductOption.fromJson(i)).toList(),
|
||||
singleSelection = json['single_selection'],
|
||||
byQuantity = json['by_quantity'],
|
||||
required = json['required'],
|
||||
extra = json['extra'],
|
||||
disabled = json['disabled'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'productoptions': productOptions,
|
||||
'single_selection': singleSelection,
|
||||
'by_quantity': byQuantity,
|
||||
'required': required,
|
||||
'extra': extra,
|
||||
'disabled': disabled
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user