Update toJson on base model

This commit is contained in:
Sambo Chea 2022-10-28 10:21:39 +07:00
parent ad17b46cc9
commit db4b9af0cd
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
3 changed files with 3 additions and 11 deletions

View File

@ -7,7 +7,9 @@ abstract class BaseModel<T> {
T fromMap(Map<String, dynamic> map); T fromMap(Map<String, dynamic> map);
T fromJson(String json); T fromJson(String json) {
return fromMap(decode(json));
}
@override @override
String toString() { String toString() {

View File

@ -25,10 +25,5 @@ class Category extends BaseModel<Category> {
}; };
} }
@override
Category fromJson(String json) {
return fromMap(decode(json));
}
static Category fromJsonString(dynamic json) => Category().fromJson(json); static Category fromJsonString(dynamic json) => Category().fromJson(json);
} }

View File

@ -29,10 +29,5 @@ class Product extends BaseModel<Product> {
}; };
} }
@override
Product fromJson(String json) {
return fromMap(decode(json));
}
static Product fromJsonString(String json) => Product().fromJson(json); static Product fromJsonString(String json) => Product().fromJson(json);
} }