/// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation import 'dart:convert'; import 'package:domain/entity/rewards_home_entity.dart'; import 'package:widgets/load_state_layout.dart'; // RewardsHomeState rewardsHomeStateFromJson(String str) => // RewardsHomeState.fromJson(json.decode(str)); String rewardsHomeStateToJson(RewardsHomeState data) => json.encode(data.toJson()); class RewardsHomeState { //页面 LoadView 状态的展示 LoadState loadingState; String? errorMessage; List> list; List> lists; List>? categoryList; RewardsHomeState({ this.loadingState = LoadState.State_Loading, String? errorMessage, required this.list, required this.lists, required this.categoryList, }); RewardsHomeState copyWith( {LoadState? loadingState, String? errorMessage, List>? categoryList, List>? list, List>? lists}) { return RewardsHomeState( loadingState: loadingState ?? this.loadingState, errorMessage: errorMessage ?? this.errorMessage, list: list ?? this.list, lists: lists ?? this.lists, categoryList: list ?? this.categoryList, ); } Map toMap() { return { 'list': List.from(lists.map((x) => x)), "lists": List.from(lists.map((x) => x)), 'categoryList': this.categoryList, }; } Map toJson() => { "lists": List.from(lists.map((x) => x)), }; factory RewardsHomeState.fromJson(Map json, dynamic map) => RewardsHomeState( lists: List>.from(json["lists"].map((x) => x)), list: List>.from(json["lists"].map((x) => x)), categoryList: map['categoryList'] as List>, ); factory RewardsHomeState.fromMap(Map map, dynamic json) { return RewardsHomeState( list: List>.from(json["lists"].map((x) => x)), lists: List>.from(json["lists"].map((x) => x)), categoryList: map['categoryList'] as List>, ); } }