first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/// 分类(type: 1=支出,2=收入)
|
||||
class Category {
|
||||
final int id;
|
||||
final String name;
|
||||
final String icon; // emoji
|
||||
final int type;
|
||||
final int? sortOrder;
|
||||
|
||||
const Category({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.icon,
|
||||
required this.type,
|
||||
this.sortOrder,
|
||||
});
|
||||
|
||||
factory Category.fromJson(Map<String, dynamic> json) => Category(
|
||||
id: (json['id'] as num?)?.toInt() ?? 0,
|
||||
name: json['name']?.toString() ?? '',
|
||||
icon: json['icon']?.toString() ?? '📦',
|
||||
type: (json['type'] as num?)?.toInt() ?? 1,
|
||||
sortOrder: (json['sortOrder'] as num?)?.toInt(),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user