初始化项目
This commit is contained in:
31
lib/controller/device/blueteeth_bind_controller.dart
Normal file
31
lib/controller/device/blueteeth_bind_controller.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'blueteeth_bind_controller.g.dart'; // 由json_serializable自动生成的部分
|
||||
|
||||
@JsonSerializable()
|
||||
class BlueteethBindModel {
|
||||
int read = 1;//是否不再提示教程 0 不再提示 1 需要提示
|
||||
|
||||
BlueteethBindModel();
|
||||
|
||||
// 从JSON反序列化时的异常处理
|
||||
|
||||
factory BlueteethBindModel.fromJson(Map<String, dynamic> json) {
|
||||
try {
|
||||
return _$BlueteethBindModelFromJson(json);
|
||||
} catch (e) {
|
||||
// 在实际应用中,应该有更细致的异常处理策略和错误日志
|
||||
return BlueteethBindModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
|
||||
}
|
||||
}
|
||||
|
||||
// 序列化为JSON时的异常处理
|
||||
Map<String, dynamic> toJson() => _$BlueteethBindModelToJson(this);
|
||||
}
|
||||
|
||||
class BlueteethBindController extends GetControllerEx<BlueteethBindModel> {
|
||||
BlueteethBindController() {
|
||||
attr = GetModel(BlueteethBindModel()).obs;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user