Commit 5d865668 authored by DatHV's avatar DatHV
Browse files

update object

parent e92ea8bf
import 'package:json_annotation/json_annotation.dart';
part 'login_token_response_model.g.dart';
@JsonSerializable()
class LoginTokenResponseModel {
String? accessToken;
String? refreshToken;
bool? forceResetPassword;
LoginTokenResponseModel({this.accessToken, this.refreshToken, this.forceResetPassword});
factory LoginTokenResponseModel.fromJson(Map<String, dynamic> json) => _$LoginTokenResponseModelFromJson(json);
Map<String, dynamic> toJson() => _$LoginTokenResponseModelToJson(this);
}
\ No newline at end of file
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'login_token_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
LoginTokenResponseModel _$LoginTokenResponseModelFromJson(
Map<String, dynamic> json,
) => LoginTokenResponseModel(
accessToken: json['accessToken'] as String?,
refreshToken: json['refreshToken'] as String?,
forceResetPassword: json['forceResetPassword'] as bool?,
);
Map<String, dynamic> _$LoginTokenResponseModelToJson(
LoginTokenResponseModel instance,
) => <String, dynamic>{
'accessToken': instance.accessToken,
'refreshToken': instance.refreshToken,
'forceResetPassword': instance.forceResetPassword,
};
class ProfileResponseModel {
}
import 'package:json_annotation/json_annotation.dart';
part 'worker_site_model.g.dart';
@JsonSerializable()
class WorkerSiteModel {
final String? id;
final String? fullname;
final String? nickname;
@JsonKey(name: "avatar_2")
final String? avatar2;
@JsonKey(name: "customer_id")
final String? customerId;
@JsonKey(name: "phone_number")
final String? phoneNumber;
final String? birthday;
final String? sex;
@JsonKey(name: "address_full")
final String? addressFull;
@JsonKey(name: "location_district_code")
final String? locationDistrictCode;
@JsonKey(name: "location_district_name")
final String? locationDistrictName;
@JsonKey(name: "location_province_code")
final String? locationProvinceCode;
@JsonKey(name: "location_province_name")
final String? locationProvinceName;
@JsonKey(name: "identification_number")
final String? identificationNumber;
final String? email;
@JsonKey(name: "sex_label")
final String? sexLabel;
WorkerSiteModel({
this.id,
this.fullname,
this.nickname,
this.avatar2,
this.customerId,
this.phoneNumber,
this.birthday,
this.sex,
this.addressFull,
this.locationDistrictCode,
this.locationDistrictName,
this.locationProvinceCode,
this.locationProvinceName,
this.identificationNumber,
this.email,
this.sexLabel,
});
/// 🎯 Convert JSON → Object
factory WorkerSiteModel.fromJson(Map<String, dynamic> json) => _$WorkerSiteModelFromJson(json);
/// 🎯 Convert Object → JSON
Map<String, dynamic> toJson() => _$WorkerSiteModelToJson(this);
bool get isRequireUpdateProfile {
return false;
// return (email == null || email!.isEmpty) || (birthday == null || birthday!.isEmpty);
}
String get usernameDisplay {
if (nickname != null && nickname!.isNotEmpty) {
return nickname!;
} else if (fullname != null && fullname!.isNotEmpty) {
return fullname!;
} else {
return "Quý Khách";
}
}
}
\ No newline at end of file
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'worker_site_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
WorkerSiteModel _$WorkerSiteModelFromJson(Map<String, dynamic> json) =>
WorkerSiteModel(
id: json['id'] as String?,
fullname: json['fullname'] as String?,
nickname: json['nickname'] as String?,
avatar2: json['avatar_2'] as String?,
customerId: json['customer_id'] as String?,
phoneNumber: json['phone_number'] as String?,
birthday: json['birthday'] as String?,
sex: json['sex'] as String?,
addressFull: json['address_full'] as String?,
locationDistrictCode: json['location_district_code'] as String?,
locationDistrictName: json['location_district_name'] as String?,
locationProvinceCode: json['location_province_code'] as String?,
locationProvinceName: json['location_province_name'] as String?,
identificationNumber: json['identification_number'] as String?,
email: json['email'] as String?,
sexLabel: json['sex_label'] as String?,
);
Map<String, dynamic> _$WorkerSiteModelToJson(WorkerSiteModel instance) =>
<String, dynamic>{
'id': instance.id,
'fullname': instance.fullname,
'nickname': instance.nickname,
'avatar_2': instance.avatar2,
'customer_id': instance.customerId,
'phone_number': instance.phoneNumber,
'birthday': instance.birthday,
'sex': instance.sex,
'address_full': instance.addressFull,
'location_district_code': instance.locationDistrictCode,
'location_district_name': instance.locationDistrictName,
'location_province_code': instance.locationProvinceCode,
'location_province_name': instance.locationProvinceName,
'identification_number': instance.identificationNumber,
'email': instance.email,
'sex_label': instance.sexLabel,
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment