初始化项目
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;
|
||||
}
|
||||
}
|
||||
15
lib/controller/device/blueteeth_bind_controller.g.dart
Normal file
15
lib/controller/device/blueteeth_bind_controller.g.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'blueteeth_bind_controller.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
BlueteethBindModel _$BlueteethBindModelFromJson(Map<String, dynamic> json) =>
|
||||
BlueteethBindModel()..read = (json['read'] as num).toInt();
|
||||
|
||||
Map<String, dynamic> _$BlueteethBindModelToJson(BlueteethBindModel instance) =>
|
||||
<String, dynamic>{
|
||||
'read': instance.read,
|
||||
};
|
||||
Reference in New Issue
Block a user