32 lines
919 B
Dart
32 lines
919 B
Dart
import 'package:ef/ef.dart';
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:vbvs_app/controller/main_bottom/main_page_controller.dart';
|
|
part 'main_page_b_controller.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class MainPageBModel {
|
|
int currentIndex = 0;
|
|
MainPageBModel();
|
|
factory MainPageBModel.fromJson(Map<String, dynamic> json) {
|
|
try {
|
|
return _$MainPageBModelFromJson(json);
|
|
} catch (e) {
|
|
// 在实际应用中,应该有更细致的异常处理策略和错误日志
|
|
return MainPageBModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
|
|
}
|
|
}
|
|
|
|
// 序列化为JSON时的异常处理
|
|
Map<String, dynamic> toJson() => _$MainPageBModelToJson(this);
|
|
}
|
|
|
|
class MainPageBController extends GetControllerEx<MainPageBModel> {
|
|
MainPageBController() {
|
|
attr = GetModel(MainPageBModel()).obs;
|
|
}
|
|
|
|
resetParm() {
|
|
model.currentIndex = 0;
|
|
}
|
|
}
|