You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
646 B
29 lines
646 B
3 years ago
|
import 'package:hive/hive.dart';
|
||
|
import 'package:json_annotation/json_annotation.dart';
|
||
|
|
||
|
part 'china_region_model.g.dart';
|
||
|
|
||
|
@JsonSerializable()
|
||
|
@HiveType(typeId: 3)
|
||
|
class ChinaRegionModel {
|
||
|
@HiveField(0)
|
||
|
final int id;
|
||
|
@HiveField(1)
|
||
|
final String name;
|
||
|
@HiveField(2)
|
||
|
final List<ChinaRegionModel> cityList;
|
||
|
|
||
|
factory ChinaRegionModel.fromJson(Map<String, dynamic> json) =>
|
||
|
_$ChinaRegionModelFromJson(json);
|
||
|
|
||
|
const ChinaRegionModel({
|
||
|
required this.id,
|
||
|
required this.name,
|
||
|
required this.cityList,
|
||
|
});
|
||
|
|
||
|
static ChinaRegionModel empty(int parentId) {
|
||
|
return ChinaRegionModel(id: 0, name: '', cityList: []);
|
||
|
}
|
||
|
}
|