feat : profile and map

This commit is contained in:
2025-07-28 15:57:30 +03:30
parent 6057976b46
commit d9724f681c
67 changed files with 2835 additions and 444 deletions

View File

@@ -0,0 +1,34 @@
import 'package:rasadyar_core/core.dart';
part 'login_request_model.freezed.dart';
part 'login_request_model.g.dart';
@freezed
abstract class LoginRequestModel with _$LoginRequestModel {
const factory LoginRequestModel({
String? username,
String? password,
String? captchaCode,
String? captchaKey,
}) = _LoginRequestModel;
factory LoginRequestModel.createWithCaptcha({
required String username,
required String password,
required String captchaCode,
required String captchaKey,
}) {
return LoginRequestModel(
username: username,
password: password,
captchaCode: captchaCode,
captchaKey: 'rest_captcha_$captchaKey.0',
);
}
factory LoginRequestModel.fromJson(Map<String, dynamic> json) =>
_$LoginRequestModelFromJson(json);
const LoginRequestModel._();
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'login_request_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LoginRequestModel {
String? get username; String? get password; String? get captchaCode; String? get captchaKey;
/// Create a copy of LoginRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LoginRequestModelCopyWith<LoginRequestModel> get copyWith => _$LoginRequestModelCopyWithImpl<LoginRequestModel>(this as LoginRequestModel, _$identity);
/// Serializes this LoginRequestModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginRequestModel&&(identical(other.username, username) || other.username == username)&&(identical(other.password, password) || other.password == password)&&(identical(other.captchaCode, captchaCode) || other.captchaCode == captchaCode)&&(identical(other.captchaKey, captchaKey) || other.captchaKey == captchaKey));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,username,password,captchaCode,captchaKey);
@override
String toString() {
return 'LoginRequestModel(username: $username, password: $password, captchaCode: $captchaCode, captchaKey: $captchaKey)';
}
}
/// @nodoc
abstract mixin class $LoginRequestModelCopyWith<$Res> {
factory $LoginRequestModelCopyWith(LoginRequestModel value, $Res Function(LoginRequestModel) _then) = _$LoginRequestModelCopyWithImpl;
@useResult
$Res call({
String? username, String? password, String? captchaCode, String? captchaKey
});
}
/// @nodoc
class _$LoginRequestModelCopyWithImpl<$Res>
implements $LoginRequestModelCopyWith<$Res> {
_$LoginRequestModelCopyWithImpl(this._self, this._then);
final LoginRequestModel _self;
final $Res Function(LoginRequestModel) _then;
/// Create a copy of LoginRequestModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? username = freezed,Object? password = freezed,Object? captchaCode = freezed,Object? captchaKey = freezed,}) {
return _then(_self.copyWith(
username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,captchaCode: freezed == captchaCode ? _self.captchaCode : captchaCode // ignore: cast_nullable_to_non_nullable
as String?,captchaKey: freezed == captchaKey ? _self.captchaKey : captchaKey // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [LoginRequestModel].
extension LoginRequestModelPatterns on LoginRequestModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LoginRequestModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _LoginRequestModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LoginRequestModel value) $default,){
final _that = this;
switch (_that) {
case _LoginRequestModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LoginRequestModel value)? $default,){
final _that = this;
switch (_that) {
case _LoginRequestModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? username, String? password, String? captchaCode, String? captchaKey)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LoginRequestModel() when $default != null:
return $default(_that.username,_that.password,_that.captchaCode,_that.captchaKey);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? username, String? password, String? captchaCode, String? captchaKey) $default,) {final _that = this;
switch (_that) {
case _LoginRequestModel():
return $default(_that.username,_that.password,_that.captchaCode,_that.captchaKey);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? username, String? password, String? captchaCode, String? captchaKey)? $default,) {final _that = this;
switch (_that) {
case _LoginRequestModel() when $default != null:
return $default(_that.username,_that.password,_that.captchaCode,_that.captchaKey);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _LoginRequestModel extends LoginRequestModel {
const _LoginRequestModel({this.username, this.password, this.captchaCode, this.captchaKey}): super._();
factory _LoginRequestModel.fromJson(Map<String, dynamic> json) => _$LoginRequestModelFromJson(json);
@override final String? username;
@override final String? password;
@override final String? captchaCode;
@override final String? captchaKey;
/// Create a copy of LoginRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LoginRequestModelCopyWith<_LoginRequestModel> get copyWith => __$LoginRequestModelCopyWithImpl<_LoginRequestModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LoginRequestModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LoginRequestModel&&(identical(other.username, username) || other.username == username)&&(identical(other.password, password) || other.password == password)&&(identical(other.captchaCode, captchaCode) || other.captchaCode == captchaCode)&&(identical(other.captchaKey, captchaKey) || other.captchaKey == captchaKey));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,username,password,captchaCode,captchaKey);
@override
String toString() {
return 'LoginRequestModel(username: $username, password: $password, captchaCode: $captchaCode, captchaKey: $captchaKey)';
}
}
/// @nodoc
abstract mixin class _$LoginRequestModelCopyWith<$Res> implements $LoginRequestModelCopyWith<$Res> {
factory _$LoginRequestModelCopyWith(_LoginRequestModel value, $Res Function(_LoginRequestModel) _then) = __$LoginRequestModelCopyWithImpl;
@override @useResult
$Res call({
String? username, String? password, String? captchaCode, String? captchaKey
});
}
/// @nodoc
class __$LoginRequestModelCopyWithImpl<$Res>
implements _$LoginRequestModelCopyWith<$Res> {
__$LoginRequestModelCopyWithImpl(this._self, this._then);
final _LoginRequestModel _self;
final $Res Function(_LoginRequestModel) _then;
/// Create a copy of LoginRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? username = freezed,Object? password = freezed,Object? captchaCode = freezed,Object? captchaKey = freezed,}) {
return _then(_LoginRequestModel(
username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,captchaCode: freezed == captchaCode ? _self.captchaCode : captchaCode // ignore: cast_nullable_to_non_nullable
as String?,captchaKey: freezed == captchaKey ? _self.captchaKey : captchaKey // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'login_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_LoginRequestModel _$LoginRequestModelFromJson(Map<String, dynamic> json) =>
_LoginRequestModel(
username: json['username'] as String?,
password: json['password'] as String?,
captchaCode: json['captcha_code'] as String?,
captchaKey: json['captcha_key'] as String?,
);
Map<String, dynamic> _$LoginRequestModelToJson(_LoginRequestModel instance) =>
<String, dynamic>{
'username': instance.username,
'password': instance.password,
'captcha_code': instance.captchaCode,
'captcha_key': instance.captchaKey,
};

View File

@@ -0,0 +1,20 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'auth_response_model.freezed.dart';
part 'auth_response_model.g.dart';
@freezed
abstract class AuthResponseModel with _$AuthResponseModel {
const factory AuthResponseModel({
String? refresh,
String? access,
bool? otpStatus,
}) = _AuthResponseModel;
factory AuthResponseModel.fromJson(Map<String, dynamic> json) =>
_$AuthResponseModelFromJson(json);
}

View File

@@ -0,0 +1,283 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'auth_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AuthResponseModel {
String? get refresh; String? get access; bool? get otpStatus;
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AuthResponseModelCopyWith<AuthResponseModel> get copyWith => _$AuthResponseModelCopyWithImpl<AuthResponseModel>(this as AuthResponseModel, _$identity);
/// Serializes this AuthResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthResponseModel&&(identical(other.refresh, refresh) || other.refresh == refresh)&&(identical(other.access, access) || other.access == access)&&(identical(other.otpStatus, otpStatus) || other.otpStatus == otpStatus));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,refresh,access,otpStatus);
@override
String toString() {
return 'AuthResponseModel(refresh: $refresh, access: $access, otpStatus: $otpStatus)';
}
}
/// @nodoc
abstract mixin class $AuthResponseModelCopyWith<$Res> {
factory $AuthResponseModelCopyWith(AuthResponseModel value, $Res Function(AuthResponseModel) _then) = _$AuthResponseModelCopyWithImpl;
@useResult
$Res call({
String? refresh, String? access, bool? otpStatus
});
}
/// @nodoc
class _$AuthResponseModelCopyWithImpl<$Res>
implements $AuthResponseModelCopyWith<$Res> {
_$AuthResponseModelCopyWithImpl(this._self, this._then);
final AuthResponseModel _self;
final $Res Function(AuthResponseModel) _then;
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? refresh = freezed,Object? access = freezed,Object? otpStatus = freezed,}) {
return _then(_self.copyWith(
refresh: freezed == refresh ? _self.refresh : refresh // ignore: cast_nullable_to_non_nullable
as String?,access: freezed == access ? _self.access : access // ignore: cast_nullable_to_non_nullable
as String?,otpStatus: freezed == otpStatus ? _self.otpStatus : otpStatus // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
/// Adds pattern-matching-related methods to [AuthResponseModel].
extension AuthResponseModelPatterns on AuthResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AuthResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AuthResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AuthResponseModel value) $default,){
final _that = this;
switch (_that) {
case _AuthResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AuthResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _AuthResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? refresh, String? access, bool? otpStatus)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AuthResponseModel() when $default != null:
return $default(_that.refresh,_that.access,_that.otpStatus);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? refresh, String? access, bool? otpStatus) $default,) {final _that = this;
switch (_that) {
case _AuthResponseModel():
return $default(_that.refresh,_that.access,_that.otpStatus);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? refresh, String? access, bool? otpStatus)? $default,) {final _that = this;
switch (_that) {
case _AuthResponseModel() when $default != null:
return $default(_that.refresh,_that.access,_that.otpStatus);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _AuthResponseModel implements AuthResponseModel {
const _AuthResponseModel({this.refresh, this.access, this.otpStatus});
factory _AuthResponseModel.fromJson(Map<String, dynamic> json) => _$AuthResponseModelFromJson(json);
@override final String? refresh;
@override final String? access;
@override final bool? otpStatus;
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AuthResponseModelCopyWith<_AuthResponseModel> get copyWith => __$AuthResponseModelCopyWithImpl<_AuthResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$AuthResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthResponseModel&&(identical(other.refresh, refresh) || other.refresh == refresh)&&(identical(other.access, access) || other.access == access)&&(identical(other.otpStatus, otpStatus) || other.otpStatus == otpStatus));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,refresh,access,otpStatus);
@override
String toString() {
return 'AuthResponseModel(refresh: $refresh, access: $access, otpStatus: $otpStatus)';
}
}
/// @nodoc
abstract mixin class _$AuthResponseModelCopyWith<$Res> implements $AuthResponseModelCopyWith<$Res> {
factory _$AuthResponseModelCopyWith(_AuthResponseModel value, $Res Function(_AuthResponseModel) _then) = __$AuthResponseModelCopyWithImpl;
@override @useResult
$Res call({
String? refresh, String? access, bool? otpStatus
});
}
/// @nodoc
class __$AuthResponseModelCopyWithImpl<$Res>
implements _$AuthResponseModelCopyWith<$Res> {
__$AuthResponseModelCopyWithImpl(this._self, this._then);
final _AuthResponseModel _self;
final $Res Function(_AuthResponseModel) _then;
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? refresh = freezed,Object? access = freezed,Object? otpStatus = freezed,}) {
return _then(_AuthResponseModel(
refresh: freezed == refresh ? _self.refresh : refresh // ignore: cast_nullable_to_non_nullable
as String?,access: freezed == access ? _self.access : access // ignore: cast_nullable_to_non_nullable
as String?,otpStatus: freezed == otpStatus ? _self.otpStatus : otpStatus // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
// dart format on

View File

@@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'auth_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_AuthResponseModel _$AuthResponseModelFromJson(Map<String, dynamic> json) =>
_AuthResponseModel(
refresh: json['refresh'] as String?,
access: json['access'] as String?,
otpStatus: json['otp_status'] as bool?,
);
Map<String, dynamic> _$AuthResponseModelToJson(_AuthResponseModel instance) =>
<String, dynamic>{
'refresh': instance.refresh,
'access': instance.access,
'otp_status': instance.otpStatus,
};

View File

@@ -0,0 +1,17 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'captcha_response_model.freezed.dart';
part 'captcha_response_model.g.dart';
@freezed
abstract class CaptchaResponseModel with _$CaptchaResponseModel {
const factory CaptchaResponseModel({
String? captchaKey,
String? captchaImage,
String? imageType,
String? imageDecode,
}) = _CaptchaResponseModel;
factory CaptchaResponseModel.fromJson(Map<String, dynamic> json) =>
_$CaptchaResponseModelFromJson(json);
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'captcha_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$CaptchaResponseModel {
String? get captchaKey; String? get captchaImage; String? get imageType; String? get imageDecode;
/// Create a copy of CaptchaResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$CaptchaResponseModelCopyWith<CaptchaResponseModel> get copyWith => _$CaptchaResponseModelCopyWithImpl<CaptchaResponseModel>(this as CaptchaResponseModel, _$identity);
/// Serializes this CaptchaResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is CaptchaResponseModel&&(identical(other.captchaKey, captchaKey) || other.captchaKey == captchaKey)&&(identical(other.captchaImage, captchaImage) || other.captchaImage == captchaImage)&&(identical(other.imageType, imageType) || other.imageType == imageType)&&(identical(other.imageDecode, imageDecode) || other.imageDecode == imageDecode));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,captchaKey,captchaImage,imageType,imageDecode);
@override
String toString() {
return 'CaptchaResponseModel(captchaKey: $captchaKey, captchaImage: $captchaImage, imageType: $imageType, imageDecode: $imageDecode)';
}
}
/// @nodoc
abstract mixin class $CaptchaResponseModelCopyWith<$Res> {
factory $CaptchaResponseModelCopyWith(CaptchaResponseModel value, $Res Function(CaptchaResponseModel) _then) = _$CaptchaResponseModelCopyWithImpl;
@useResult
$Res call({
String? captchaKey, String? captchaImage, String? imageType, String? imageDecode
});
}
/// @nodoc
class _$CaptchaResponseModelCopyWithImpl<$Res>
implements $CaptchaResponseModelCopyWith<$Res> {
_$CaptchaResponseModelCopyWithImpl(this._self, this._then);
final CaptchaResponseModel _self;
final $Res Function(CaptchaResponseModel) _then;
/// Create a copy of CaptchaResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? captchaKey = freezed,Object? captchaImage = freezed,Object? imageType = freezed,Object? imageDecode = freezed,}) {
return _then(_self.copyWith(
captchaKey: freezed == captchaKey ? _self.captchaKey : captchaKey // ignore: cast_nullable_to_non_nullable
as String?,captchaImage: freezed == captchaImage ? _self.captchaImage : captchaImage // ignore: cast_nullable_to_non_nullable
as String?,imageType: freezed == imageType ? _self.imageType : imageType // ignore: cast_nullable_to_non_nullable
as String?,imageDecode: freezed == imageDecode ? _self.imageDecode : imageDecode // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [CaptchaResponseModel].
extension CaptchaResponseModelPatterns on CaptchaResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _CaptchaResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _CaptchaResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _CaptchaResponseModel value) $default,){
final _that = this;
switch (_that) {
case _CaptchaResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _CaptchaResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _CaptchaResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? captchaKey, String? captchaImage, String? imageType, String? imageDecode)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _CaptchaResponseModel() when $default != null:
return $default(_that.captchaKey,_that.captchaImage,_that.imageType,_that.imageDecode);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? captchaKey, String? captchaImage, String? imageType, String? imageDecode) $default,) {final _that = this;
switch (_that) {
case _CaptchaResponseModel():
return $default(_that.captchaKey,_that.captchaImage,_that.imageType,_that.imageDecode);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? captchaKey, String? captchaImage, String? imageType, String? imageDecode)? $default,) {final _that = this;
switch (_that) {
case _CaptchaResponseModel() when $default != null:
return $default(_that.captchaKey,_that.captchaImage,_that.imageType,_that.imageDecode);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _CaptchaResponseModel implements CaptchaResponseModel {
const _CaptchaResponseModel({this.captchaKey, this.captchaImage, this.imageType, this.imageDecode});
factory _CaptchaResponseModel.fromJson(Map<String, dynamic> json) => _$CaptchaResponseModelFromJson(json);
@override final String? captchaKey;
@override final String? captchaImage;
@override final String? imageType;
@override final String? imageDecode;
/// Create a copy of CaptchaResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$CaptchaResponseModelCopyWith<_CaptchaResponseModel> get copyWith => __$CaptchaResponseModelCopyWithImpl<_CaptchaResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$CaptchaResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CaptchaResponseModel&&(identical(other.captchaKey, captchaKey) || other.captchaKey == captchaKey)&&(identical(other.captchaImage, captchaImage) || other.captchaImage == captchaImage)&&(identical(other.imageType, imageType) || other.imageType == imageType)&&(identical(other.imageDecode, imageDecode) || other.imageDecode == imageDecode));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,captchaKey,captchaImage,imageType,imageDecode);
@override
String toString() {
return 'CaptchaResponseModel(captchaKey: $captchaKey, captchaImage: $captchaImage, imageType: $imageType, imageDecode: $imageDecode)';
}
}
/// @nodoc
abstract mixin class _$CaptchaResponseModelCopyWith<$Res> implements $CaptchaResponseModelCopyWith<$Res> {
factory _$CaptchaResponseModelCopyWith(_CaptchaResponseModel value, $Res Function(_CaptchaResponseModel) _then) = __$CaptchaResponseModelCopyWithImpl;
@override @useResult
$Res call({
String? captchaKey, String? captchaImage, String? imageType, String? imageDecode
});
}
/// @nodoc
class __$CaptchaResponseModelCopyWithImpl<$Res>
implements _$CaptchaResponseModelCopyWith<$Res> {
__$CaptchaResponseModelCopyWithImpl(this._self, this._then);
final _CaptchaResponseModel _self;
final $Res Function(_CaptchaResponseModel) _then;
/// Create a copy of CaptchaResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? captchaKey = freezed,Object? captchaImage = freezed,Object? imageType = freezed,Object? imageDecode = freezed,}) {
return _then(_CaptchaResponseModel(
captchaKey: freezed == captchaKey ? _self.captchaKey : captchaKey // ignore: cast_nullable_to_non_nullable
as String?,captchaImage: freezed == captchaImage ? _self.captchaImage : captchaImage // ignore: cast_nullable_to_non_nullable
as String?,imageType: freezed == imageType ? _self.imageType : imageType // ignore: cast_nullable_to_non_nullable
as String?,imageDecode: freezed == imageDecode ? _self.imageDecode : imageDecode // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,25 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'captcha_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_CaptchaResponseModel _$CaptchaResponseModelFromJson(
Map<String, dynamic> json,
) => _CaptchaResponseModel(
captchaKey: json['captcha_key'] as String?,
captchaImage: json['captcha_image'] as String?,
imageType: json['image_type'] as String?,
imageDecode: json['image_decode'] as String?,
);
Map<String, dynamic> _$CaptchaResponseModelToJson(
_CaptchaResponseModel instance,
) => <String, dynamic>{
'captcha_key': instance.captchaKey,
'captcha_image': instance.captchaImage,
'image_type': instance.imageType,
'image_decode': instance.imageDecode,
};

View File

@@ -0,0 +1,68 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'poultry_location_model.freezed.dart';
part 'poultry_location_model.g.dart';
@freezed
abstract class PoultryLocationModel with _$PoultryLocationModel {
const factory PoultryLocationModel({
int? id,
String? unitName,
@JsonKey(name: 'Lat')
double? lat,
@JsonKey(name: 'Long')
double? long,
User? user,
List<Hatching>? hatching,
Address? address,
}) = _PoultryLocationModel;
factory PoultryLocationModel.fromJson(Map<String, dynamic> json) =>
_$PoultryLocationModelFromJson(json);
}
@freezed
abstract class User with _$User {
const factory User({
String? fullname,
String? mobile,
}) = _User;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}
@freezed
abstract class Hatching with _$Hatching {
const factory Hatching({
int? quantity,
int? leftOver,
int? period,
int? chickenAge,
DateTime? date,
bool?violation,
bool?archive,
}) = _Hatching;
factory Hatching.fromJson(Map<String, dynamic> json) =>
_$HatchingFromJson(json);
}
@freezed
abstract class Address with _$Address {
const factory Address({
City? city,
String? address,
}) = _Address;
factory Address.fromJson(Map<String, dynamic> json) =>
_$AddressFromJson(json);
}
@freezed
abstract class City with _$City {
const factory City({
String? name,
}) = _City;
factory City.fromJson(Map<String, dynamic> json) => _$CityFromJson(json);
}

View File

@@ -0,0 +1,73 @@
import 'package:rasadyar_core/core.dart';
part 'user_profile_model.freezed.dart';
part 'user_profile_model.g.dart';
@freezed
abstract class UserProfileModel with _$UserProfileModel {
const factory UserProfileModel({
required User user,
required Role role,
required List<Permission> permissions,
}) = _UserProfileModel;
factory UserProfileModel.fromJson(Map<String, dynamic> json) => _$UserProfileModelFromJson(json);
}
@freezed
abstract class User with _$User {
const factory User({
required int id,
required String username,
required String password,
required String firstName,
required String lastName,
required bool isActive,
required String mobile,
required String phone,
required String nationalCode,
required DateTime birthdate,
required String nationality,
required String ownership,
required String address,
required String photo,
required int province,
required int city,
required bool otpStatus,
required String cityName,
required String provinceName,
}) = _User;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}
@freezed
abstract class Role with _$Role {
const factory Role({
required int id,
required String roleName,
required String description,
required RoleType type,
required List<dynamic> permissions,
}) = _Role;
factory Role.fromJson(Map<String, dynamic> json) => _$RoleFromJson(json);
}
@freezed
abstract class RoleType with _$RoleType {
const factory RoleType({String? key, required String name}) = _RoleType;
factory RoleType.fromJson(Map<String, dynamic> json) => _$RoleTypeFromJson(json);
}
@freezed
abstract class Permission with _$Permission {
const factory Permission({required String pageName, required List<String> pageAccess}) =
_Permission;
factory Permission.fromJson(Map<String, dynamic> json) => _$PermissionFromJson(json);
}