chore : delete auth package because each project has different auth , must be separated auth logic
This commit is contained in:
@@ -38,11 +38,15 @@ export 'package:rasadyar_core/presentation/utils/utils.dart';
|
||||
export 'package:rasadyar_core/presentation/widget/widget.dart';
|
||||
|
||||
//models
|
||||
export 'data/model/pagination_model/pagination_model.dart';
|
||||
export 'data/model/model.dart';
|
||||
//data
|
||||
export 'data/services/services.dart';
|
||||
//infrastructure
|
||||
export 'infrastructure/infrastructure.dart';
|
||||
export 'infrastructure/local/hive_local_storage.dart';
|
||||
export 'injection/di.dart';
|
||||
//routing
|
||||
export 'routing/auth_route_resolver.dart';
|
||||
export 'utils/extension/date_time_utils.dart';
|
||||
export 'utils/extension/num_utils.dart';
|
||||
export 'utils/extension/string_utils.dart';
|
||||
|
||||
16
packages/core/lib/data/model/local/module/module_model.dart
Normal file
16
packages/core/lib/data/model/local/module/module_model.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart';
|
||||
|
||||
part 'module_model.freezed.dart';
|
||||
|
||||
|
||||
@freezed
|
||||
abstract class ModuleModel with _$ModuleModel{
|
||||
const factory ModuleModel({
|
||||
required String title,
|
||||
required String icon,
|
||||
required Module module,
|
||||
}) = _ModuleModel;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
// 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 'module_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ModuleModel {
|
||||
|
||||
String get title; String get icon; Module get module;
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ModuleModelCopyWith<ModuleModel> get copyWith => _$ModuleModelCopyWithImpl<ModuleModel>(this as ModuleModel, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.module, module) || other.module == module));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,title,icon,module);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ModuleModel(title: $title, icon: $icon, module: $module)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ModuleModelCopyWith<$Res> {
|
||||
factory $ModuleModelCopyWith(ModuleModel value, $Res Function(ModuleModel) _then) = _$ModuleModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String title, String icon, Module module
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ModuleModelCopyWithImpl<$Res>
|
||||
implements $ModuleModelCopyWith<$Res> {
|
||||
_$ModuleModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ModuleModel _self;
|
||||
final $Res Function(ModuleModel) _then;
|
||||
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? icon = null,Object? module = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as String,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
|
||||
as Module,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ModuleModel].
|
||||
extension ModuleModelPatterns on ModuleModel {
|
||||
/// 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( _ModuleModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel() 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( _ModuleModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel():
|
||||
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( _ModuleModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel() 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 title, String icon, Module module)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel() when $default != null:
|
||||
return $default(_that.title,_that.icon,_that.module);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 title, String icon, Module module) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel():
|
||||
return $default(_that.title,_that.icon,_that.module);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 title, String icon, Module module)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel() when $default != null:
|
||||
return $default(_that.title,_that.icon,_that.module);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _ModuleModel implements ModuleModel {
|
||||
const _ModuleModel({required this.title, required this.icon, required this.module});
|
||||
|
||||
|
||||
@override final String title;
|
||||
@override final String icon;
|
||||
@override final Module module;
|
||||
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ModuleModelCopyWith<_ModuleModel> get copyWith => __$ModuleModelCopyWithImpl<_ModuleModel>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.module, module) || other.module == module));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,title,icon,module);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ModuleModel(title: $title, icon: $icon, module: $module)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ModuleModelCopyWith<$Res> implements $ModuleModelCopyWith<$Res> {
|
||||
factory _$ModuleModelCopyWith(_ModuleModel value, $Res Function(_ModuleModel) _then) = __$ModuleModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String title, String icon, Module module
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ModuleModelCopyWithImpl<$Res>
|
||||
implements _$ModuleModelCopyWith<$Res> {
|
||||
__$ModuleModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ModuleModel _self;
|
||||
final $Res Function(_ModuleModel) _then;
|
||||
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? icon = null,Object? module = null,}) {
|
||||
return _then(_ModuleModel(
|
||||
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as String,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
|
||||
as Module,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/utils/local/local_utils.dart';
|
||||
|
||||
part 'user_local_model.g.dart';
|
||||
|
||||
@HiveType(typeId: authUserLocalModelTypeId)
|
||||
class UserLocalModel extends HiveObject {
|
||||
@HiveField(0)
|
||||
String? username;
|
||||
@HiveField(1)
|
||||
String? password;
|
||||
@HiveField(2)
|
||||
String? token;
|
||||
@HiveField(3)
|
||||
String? refreshToken;
|
||||
@HiveField(4)
|
||||
String? name;
|
||||
|
||||
@HiveField(5)
|
||||
Module? module;
|
||||
|
||||
@HiveField(6)
|
||||
String? backend;
|
||||
|
||||
@HiveField(7)
|
||||
String? apiKey;
|
||||
|
||||
UserLocalModel({
|
||||
this.username,
|
||||
this.password,
|
||||
this.token,
|
||||
this.refreshToken,
|
||||
this.name,
|
||||
this.module,
|
||||
this.backend,
|
||||
this.apiKey,
|
||||
});
|
||||
|
||||
UserLocalModel copyWith({
|
||||
String? username,
|
||||
String? password,
|
||||
String? token,
|
||||
String? refreshToken,
|
||||
String? name,
|
||||
Module? module,
|
||||
String? backend,
|
||||
String? apiKey,
|
||||
}) {
|
||||
return UserLocalModel(
|
||||
username: username ?? this.username,
|
||||
password: password ?? this.password,
|
||||
token: token ?? this.token,
|
||||
refreshToken: refreshToken ?? this.refreshToken,
|
||||
name: name ?? this.name,
|
||||
module: module ?? this.module,
|
||||
backend: backend ?? this.backend,
|
||||
apiKey: apiKey ?? this.apiKey,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: authModuleTypeId)
|
||||
enum Module {
|
||||
@HiveField(0)
|
||||
liveStocks,
|
||||
@HiveField(1)
|
||||
inspection,
|
||||
@HiveField(2)
|
||||
chicken,
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_local_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class UserLocalModelAdapter extends TypeAdapter<UserLocalModel> {
|
||||
@override
|
||||
final typeId = 0;
|
||||
|
||||
@override
|
||||
UserLocalModel read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return UserLocalModel(
|
||||
username: fields[0] as String?,
|
||||
password: fields[1] as String?,
|
||||
token: fields[2] as String?,
|
||||
refreshToken: fields[3] as String?,
|
||||
name: fields[4] as String?,
|
||||
module: fields[5] as Module?,
|
||||
backend: fields[6] as String?,
|
||||
apiKey: fields[7] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, UserLocalModel obj) {
|
||||
writer
|
||||
..writeByte(8)
|
||||
..writeByte(0)
|
||||
..write(obj.username)
|
||||
..writeByte(1)
|
||||
..write(obj.password)
|
||||
..writeByte(2)
|
||||
..write(obj.token)
|
||||
..writeByte(3)
|
||||
..write(obj.refreshToken)
|
||||
..writeByte(4)
|
||||
..write(obj.name)
|
||||
..writeByte(5)
|
||||
..write(obj.module)
|
||||
..writeByte(6)
|
||||
..write(obj.backend)
|
||||
..writeByte(7)
|
||||
..write(obj.apiKey);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserLocalModelAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class ModuleAdapter extends TypeAdapter<Module> {
|
||||
@override
|
||||
final typeId = 1;
|
||||
|
||||
@override
|
||||
Module read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return Module.liveStocks;
|
||||
case 1:
|
||||
return Module.inspection;
|
||||
case 2:
|
||||
return Module.chicken;
|
||||
default:
|
||||
return Module.liveStocks;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, Module obj) {
|
||||
switch (obj) {
|
||||
case Module.liveStocks:
|
||||
writer.writeByte(0);
|
||||
case Module.inspection:
|
||||
writer.writeByte(1);
|
||||
case Module.chicken:
|
||||
writer.writeByte(2);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ModuleAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
3
packages/core/lib/data/model/model.dart
Normal file
3
packages/core/lib/data/model/model.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
export 'local/module/module_model.dart';
|
||||
export 'local/user_local/user_local_model.dart';
|
||||
export 'pagination_model/pagination_model.dart';
|
||||
@@ -1,6 +1,5 @@
|
||||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// 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
|
||||
|
||||
@@ -79,6 +78,136 @@ as List<T>?,
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PaginationModel].
|
||||
extension PaginationModelPatterns<T> on PaginationModel<T> {
|
||||
/// 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( _PaginationModel<T> value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaginationModel() 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( _PaginationModel<T> value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaginationModel():
|
||||
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( _PaginationModel<T> value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PaginationModel() 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( int? count, String? next, String? previous, List<T>? results)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaginationModel() when $default != null:
|
||||
return $default(_that.count,_that.next,_that.previous,_that.results);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( int? count, String? next, String? previous, List<T>? results) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaginationModel():
|
||||
return $default(_that.count,_that.next,_that.previous,_that.results);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( int? count, String? next, String? previous, List<T>? results)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PaginationModel() when $default != null:
|
||||
return $default(_that.count,_that.next,_that.previous,_that.results);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable(genericArgumentFactories: true)
|
||||
|
||||
|
||||
@@ -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._();
|
||||
|
||||
}
|
||||
@@ -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
|
||||
@@ -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['captchaCode'] as String?,
|
||||
captchaKey: json['captchaKey'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LoginRequestModelToJson(_LoginRequestModel instance) =>
|
||||
<String, dynamic>{
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
'captchaCode': instance.captchaCode,
|
||||
'captchaKey': instance.captchaKey,
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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['otpStatus'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$AuthResponseModelToJson(_AuthResponseModel instance) =>
|
||||
<String, dynamic>{
|
||||
'refresh': instance.refresh,
|
||||
'access': instance.access,
|
||||
'otpStatus': instance.otpStatus,
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
@@ -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['captchaKey'] as String?,
|
||||
captchaImage: json['captchaImage'] as String?,
|
||||
imageType: json['imageType'] as String?,
|
||||
imageDecode: json['imageDecode'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CaptchaResponseModelToJson(
|
||||
_CaptchaResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'captchaKey': instance.captchaKey,
|
||||
'captchaImage': instance.captchaImage,
|
||||
'imageType': instance.imageType,
|
||||
'imageDecode': instance.imageDecode,
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'user_info_model.freezed.dart';
|
||||
|
||||
part 'user_info_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UserInfoModel with _$UserInfoModel {
|
||||
const factory UserInfoModel({
|
||||
bool? isUser,
|
||||
String? address,
|
||||
String? backend,
|
||||
String? apiKey,
|
||||
}) = _UserInfoModel ;
|
||||
|
||||
factory UserInfoModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserInfoModelFromJson(json);
|
||||
}
|
||||
@@ -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 'user_info_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserInfoModel {
|
||||
|
||||
bool? get isUser; String? get address; String? get backend; String? get apiKey;
|
||||
/// Create a copy of UserInfoModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserInfoModelCopyWith<UserInfoModel> get copyWith => _$UserInfoModelCopyWithImpl<UserInfoModel>(this as UserInfoModel, _$identity);
|
||||
|
||||
/// Serializes this UserInfoModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserInfoModel&&(identical(other.isUser, isUser) || other.isUser == isUser)&&(identical(other.address, address) || other.address == address)&&(identical(other.backend, backend) || other.backend == backend)&&(identical(other.apiKey, apiKey) || other.apiKey == apiKey));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isUser,address,backend,apiKey);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserInfoModel(isUser: $isUser, address: $address, backend: $backend, apiKey: $apiKey)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UserInfoModelCopyWith<$Res> {
|
||||
factory $UserInfoModelCopyWith(UserInfoModel value, $Res Function(UserInfoModel) _then) = _$UserInfoModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool? isUser, String? address, String? backend, String? apiKey
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UserInfoModelCopyWithImpl<$Res>
|
||||
implements $UserInfoModelCopyWith<$Res> {
|
||||
_$UserInfoModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UserInfoModel _self;
|
||||
final $Res Function(UserInfoModel) _then;
|
||||
|
||||
/// Create a copy of UserInfoModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isUser = freezed,Object? address = freezed,Object? backend = freezed,Object? apiKey = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
isUser: freezed == isUser ? _self.isUser : isUser // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String?,backend: freezed == backend ? _self.backend : backend // ignore: cast_nullable_to_non_nullable
|
||||
as String?,apiKey: freezed == apiKey ? _self.apiKey : apiKey // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UserInfoModel].
|
||||
extension UserInfoModelPatterns on UserInfoModel {
|
||||
/// 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( _UserInfoModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserInfoModel() 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( _UserInfoModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserInfoModel():
|
||||
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( _UserInfoModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserInfoModel() 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( bool? isUser, String? address, String? backend, String? apiKey)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserInfoModel() when $default != null:
|
||||
return $default(_that.isUser,_that.address,_that.backend,_that.apiKey);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( bool? isUser, String? address, String? backend, String? apiKey) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserInfoModel():
|
||||
return $default(_that.isUser,_that.address,_that.backend,_that.apiKey);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( bool? isUser, String? address, String? backend, String? apiKey)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserInfoModel() when $default != null:
|
||||
return $default(_that.isUser,_that.address,_that.backend,_that.apiKey);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UserInfoModel implements UserInfoModel {
|
||||
const _UserInfoModel({this.isUser, this.address, this.backend, this.apiKey});
|
||||
factory _UserInfoModel.fromJson(Map<String, dynamic> json) => _$UserInfoModelFromJson(json);
|
||||
|
||||
@override final bool? isUser;
|
||||
@override final String? address;
|
||||
@override final String? backend;
|
||||
@override final String? apiKey;
|
||||
|
||||
/// Create a copy of UserInfoModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UserInfoModelCopyWith<_UserInfoModel> get copyWith => __$UserInfoModelCopyWithImpl<_UserInfoModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UserInfoModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserInfoModel&&(identical(other.isUser, isUser) || other.isUser == isUser)&&(identical(other.address, address) || other.address == address)&&(identical(other.backend, backend) || other.backend == backend)&&(identical(other.apiKey, apiKey) || other.apiKey == apiKey));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isUser,address,backend,apiKey);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserInfoModel(isUser: $isUser, address: $address, backend: $backend, apiKey: $apiKey)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UserInfoModelCopyWith<$Res> implements $UserInfoModelCopyWith<$Res> {
|
||||
factory _$UserInfoModelCopyWith(_UserInfoModel value, $Res Function(_UserInfoModel) _then) = __$UserInfoModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool? isUser, String? address, String? backend, String? apiKey
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UserInfoModelCopyWithImpl<$Res>
|
||||
implements _$UserInfoModelCopyWith<$Res> {
|
||||
__$UserInfoModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UserInfoModel _self;
|
||||
final $Res Function(_UserInfoModel) _then;
|
||||
|
||||
/// Create a copy of UserInfoModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isUser = freezed,Object? address = freezed,Object? backend = freezed,Object? apiKey = freezed,}) {
|
||||
return _then(_UserInfoModel(
|
||||
isUser: freezed == isUser ? _self.isUser : isUser // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String?,backend: freezed == backend ? _self.backend : backend // ignore: cast_nullable_to_non_nullable
|
||||
as String?,apiKey: freezed == apiKey ? _self.apiKey : apiKey // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,23 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_info_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
|
||||
_UserInfoModel(
|
||||
isUser: json['isUser'] as bool?,
|
||||
address: json['address'] as String?,
|
||||
backend: json['backend'] as String?,
|
||||
apiKey: json['apiKey'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserInfoModelToJson(_UserInfoModel instance) =>
|
||||
<String, dynamic>{
|
||||
'isUser': instance.isUser,
|
||||
'address': instance.address,
|
||||
'backend': instance.backend,
|
||||
'apiKey': instance.apiKey,
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'user_profile_model.freezed.dart';
|
||||
|
||||
part 'user_profile_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UserProfileModel with _$UserProfileModel {
|
||||
const factory UserProfileModel({
|
||||
String? accessToken,
|
||||
String? expiresIn,
|
||||
String? scope,
|
||||
String? expireTime,
|
||||
String? mobile,
|
||||
String? fullname,
|
||||
String? firstname,
|
||||
String? lastname,
|
||||
String? city,
|
||||
String? province,
|
||||
String? nationalCode,
|
||||
String? nationalId,
|
||||
String? birthday,
|
||||
String? image,
|
||||
int? baseOrder,
|
||||
List<String>? role,
|
||||
}) = _UserProfileModel;
|
||||
|
||||
factory UserProfileModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserProfileModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
// 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 'user_profile_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserProfileModel {
|
||||
|
||||
String? get accessToken; String? get expiresIn; String? get scope; String? get expireTime; String? get mobile; String? get fullname; String? get firstname; String? get lastname; String? get city; String? get province; String? get nationalCode; String? get nationalId; String? get birthday; String? get image; int? get baseOrder; List<String>? get role;
|
||||
/// Create a copy of UserProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserProfileModelCopyWith<UserProfileModel> get copyWith => _$UserProfileModelCopyWithImpl<UserProfileModel>(this as UserProfileModel, _$identity);
|
||||
|
||||
/// Serializes this UserProfileModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserProfileModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.expiresIn, expiresIn) || other.expiresIn == expiresIn)&&(identical(other.scope, scope) || other.scope == scope)&&(identical(other.expireTime, expireTime) || other.expireTime == expireTime)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstname, firstname) || other.firstname == firstname)&&(identical(other.lastname, lastname) || other.lastname == lastname)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&const DeepCollectionEquality().equals(other.role, role));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,accessToken,expiresIn,scope,expireTime,mobile,fullname,firstname,lastname,city,province,nationalCode,nationalId,birthday,image,baseOrder,const DeepCollectionEquality().hash(role));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserProfileModel(accessToken: $accessToken, expiresIn: $expiresIn, scope: $scope, expireTime: $expireTime, mobile: $mobile, fullname: $fullname, firstname: $firstname, lastname: $lastname, city: $city, province: $province, nationalCode: $nationalCode, nationalId: $nationalId, birthday: $birthday, image: $image, baseOrder: $baseOrder, role: $role)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UserProfileModelCopyWith<$Res> {
|
||||
factory $UserProfileModelCopyWith(UserProfileModel value, $Res Function(UserProfileModel) _then) = _$UserProfileModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UserProfileModelCopyWithImpl<$Res>
|
||||
implements $UserProfileModelCopyWith<$Res> {
|
||||
_$UserProfileModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UserProfileModel _self;
|
||||
final $Res Function(UserProfileModel) _then;
|
||||
|
||||
/// Create a copy of UserProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? accessToken = freezed,Object? expiresIn = freezed,Object? scope = freezed,Object? expireTime = freezed,Object? mobile = freezed,Object? fullname = freezed,Object? firstname = freezed,Object? lastname = freezed,Object? city = freezed,Object? province = freezed,Object? nationalCode = freezed,Object? nationalId = freezed,Object? birthday = freezed,Object? image = freezed,Object? baseOrder = freezed,Object? role = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String?,expiresIn: freezed == expiresIn ? _self.expiresIn : expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as String?,scope: freezed == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable
|
||||
as String?,expireTime: freezed == expireTime ? _self.expireTime : expireTime // ignore: cast_nullable_to_non_nullable
|
||||
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
|
||||
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
|
||||
as String?,firstname: freezed == firstname ? _self.firstname : firstname // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lastname: freezed == lastname ? _self.lastname : lastname // ignore: cast_nullable_to_non_nullable
|
||||
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable
|
||||
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
|
||||
as String?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable
|
||||
as int?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UserProfileModel].
|
||||
extension UserProfileModelPatterns on UserProfileModel {
|
||||
/// 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( _UserProfileModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserProfileModel() 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( _UserProfileModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserProfileModel():
|
||||
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( _UserProfileModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UserProfileModel() 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? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserProfileModel() when $default != null:
|
||||
return $default(_that.accessToken,_that.expiresIn,_that.scope,_that.expireTime,_that.mobile,_that.fullname,_that.firstname,_that.lastname,_that.city,_that.province,_that.nationalCode,_that.nationalId,_that.birthday,_that.image,_that.baseOrder,_that.role);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? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserProfileModel():
|
||||
return $default(_that.accessToken,_that.expiresIn,_that.scope,_that.expireTime,_that.mobile,_that.fullname,_that.firstname,_that.lastname,_that.city,_that.province,_that.nationalCode,_that.nationalId,_that.birthday,_that.image,_that.baseOrder,_that.role);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? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UserProfileModel() when $default != null:
|
||||
return $default(_that.accessToken,_that.expiresIn,_that.scope,_that.expireTime,_that.mobile,_that.fullname,_that.firstname,_that.lastname,_that.city,_that.province,_that.nationalCode,_that.nationalId,_that.birthday,_that.image,_that.baseOrder,_that.role);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UserProfileModel implements UserProfileModel {
|
||||
const _UserProfileModel({this.accessToken, this.expiresIn, this.scope, this.expireTime, this.mobile, this.fullname, this.firstname, this.lastname, this.city, this.province, this.nationalCode, this.nationalId, this.birthday, this.image, this.baseOrder, final List<String>? role}): _role = role;
|
||||
factory _UserProfileModel.fromJson(Map<String, dynamic> json) => _$UserProfileModelFromJson(json);
|
||||
|
||||
@override final String? accessToken;
|
||||
@override final String? expiresIn;
|
||||
@override final String? scope;
|
||||
@override final String? expireTime;
|
||||
@override final String? mobile;
|
||||
@override final String? fullname;
|
||||
@override final String? firstname;
|
||||
@override final String? lastname;
|
||||
@override final String? city;
|
||||
@override final String? province;
|
||||
@override final String? nationalCode;
|
||||
@override final String? nationalId;
|
||||
@override final String? birthday;
|
||||
@override final String? image;
|
||||
@override final int? baseOrder;
|
||||
final List<String>? _role;
|
||||
@override List<String>? get role {
|
||||
final value = _role;
|
||||
if (value == null) return null;
|
||||
if (_role is EqualUnmodifiableListView) return _role;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of UserProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UserProfileModelCopyWith<_UserProfileModel> get copyWith => __$UserProfileModelCopyWithImpl<_UserProfileModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UserProfileModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserProfileModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.expiresIn, expiresIn) || other.expiresIn == expiresIn)&&(identical(other.scope, scope) || other.scope == scope)&&(identical(other.expireTime, expireTime) || other.expireTime == expireTime)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstname, firstname) || other.firstname == firstname)&&(identical(other.lastname, lastname) || other.lastname == lastname)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&const DeepCollectionEquality().equals(other._role, _role));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,accessToken,expiresIn,scope,expireTime,mobile,fullname,firstname,lastname,city,province,nationalCode,nationalId,birthday,image,baseOrder,const DeepCollectionEquality().hash(_role));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserProfileModel(accessToken: $accessToken, expiresIn: $expiresIn, scope: $scope, expireTime: $expireTime, mobile: $mobile, fullname: $fullname, firstname: $firstname, lastname: $lastname, city: $city, province: $province, nationalCode: $nationalCode, nationalId: $nationalId, birthday: $birthday, image: $image, baseOrder: $baseOrder, role: $role)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UserProfileModelCopyWith<$Res> implements $UserProfileModelCopyWith<$Res> {
|
||||
factory _$UserProfileModelCopyWith(_UserProfileModel value, $Res Function(_UserProfileModel) _then) = __$UserProfileModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UserProfileModelCopyWithImpl<$Res>
|
||||
implements _$UserProfileModelCopyWith<$Res> {
|
||||
__$UserProfileModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UserProfileModel _self;
|
||||
final $Res Function(_UserProfileModel) _then;
|
||||
|
||||
/// Create a copy of UserProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? accessToken = freezed,Object? expiresIn = freezed,Object? scope = freezed,Object? expireTime = freezed,Object? mobile = freezed,Object? fullname = freezed,Object? firstname = freezed,Object? lastname = freezed,Object? city = freezed,Object? province = freezed,Object? nationalCode = freezed,Object? nationalId = freezed,Object? birthday = freezed,Object? image = freezed,Object? baseOrder = freezed,Object? role = freezed,}) {
|
||||
return _then(_UserProfileModel(
|
||||
accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String?,expiresIn: freezed == expiresIn ? _self.expiresIn : expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as String?,scope: freezed == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable
|
||||
as String?,expireTime: freezed == expireTime ? _self.expireTime : expireTime // ignore: cast_nullable_to_non_nullable
|
||||
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
|
||||
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
|
||||
as String?,firstname: freezed == firstname ? _self.firstname : firstname // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lastname: freezed == lastname ? _self.lastname : lastname // ignore: cast_nullable_to_non_nullable
|
||||
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable
|
||||
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
|
||||
as String?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable
|
||||
as int?,role: freezed == role ? _self._role : role // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,47 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_profile_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UserProfileModel _$UserProfileModelFromJson(Map<String, dynamic> json) =>
|
||||
_UserProfileModel(
|
||||
accessToken: json['accessToken'] as String?,
|
||||
expiresIn: json['expiresIn'] as String?,
|
||||
scope: json['scope'] as String?,
|
||||
expireTime: json['expireTime'] as String?,
|
||||
mobile: json['mobile'] as String?,
|
||||
fullname: json['fullname'] as String?,
|
||||
firstname: json['firstname'] as String?,
|
||||
lastname: json['lastname'] as String?,
|
||||
city: json['city'] as String?,
|
||||
province: json['province'] as String?,
|
||||
nationalCode: json['nationalCode'] as String?,
|
||||
nationalId: json['nationalId'] as String?,
|
||||
birthday: json['birthday'] as String?,
|
||||
image: json['image'] as String?,
|
||||
baseOrder: (json['baseOrder'] as num?)?.toInt(),
|
||||
role: (json['role'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserProfileModelToJson(_UserProfileModel instance) =>
|
||||
<String, dynamic>{
|
||||
'accessToken': instance.accessToken,
|
||||
'expiresIn': instance.expiresIn,
|
||||
'scope': instance.scope,
|
||||
'expireTime': instance.expireTime,
|
||||
'mobile': instance.mobile,
|
||||
'fullname': instance.fullname,
|
||||
'firstname': instance.firstname,
|
||||
'lastname': instance.lastname,
|
||||
'city': instance.city,
|
||||
'province': instance.province,
|
||||
'nationalCode': instance.nationalCode,
|
||||
'nationalId': instance.nationalId,
|
||||
'birthday': instance.birthday,
|
||||
'image': instance.image,
|
||||
'baseOrder': instance.baseOrder,
|
||||
'role': instance.role,
|
||||
};
|
||||
23
packages/core/lib/data/services/auth_middelware.dart
Normal file
23
packages/core/lib/data/services/auth_middelware.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class AuthMiddleware extends GetMiddleware {
|
||||
final tokenService = Get.find<TokenStorageService>();
|
||||
final authRouteResolver = Get.find<AuthRouteResolver>();
|
||||
|
||||
@override
|
||||
RouteSettings? redirect(String? route) {
|
||||
final refreshToken = tokenService.refreshToken.value;
|
||||
final accessToken = tokenService.accessToken.value;
|
||||
final module = tokenService.appModule.value;
|
||||
|
||||
if (refreshToken == null || accessToken == null) {
|
||||
if (module != null) {
|
||||
final authRoute = authRouteResolver.getAuthRouteForModule(module);
|
||||
return RouteSettings(name: authRoute, arguments: module);
|
||||
}
|
||||
return RouteSettings(name: authRouteResolver.getFallbackRoute());
|
||||
}
|
||||
return super.redirect(route);
|
||||
}
|
||||
}
|
||||
2
packages/core/lib/data/services/services.dart
Normal file
2
packages/core/lib/data/services/services.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'auth_middelware.dart';
|
||||
export 'token_storage_service.dart';
|
||||
84
packages/core/lib/data/services/token_storage_service.dart
Normal file
84
packages/core/lib/data/services/token_storage_service.dart
Normal file
@@ -0,0 +1,84 @@
|
||||
import 'dart:convert';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/hive_registrar.g.dart';
|
||||
|
||||
class TokenStorageService extends GetxService {
|
||||
static const String _tokenBoxName = 'TokenBox';
|
||||
static const String _appBoxName = 'AppBox';
|
||||
static const String _accessTokenKey = 'accessToken';
|
||||
static const String _refreshTokenKey = 'refreshToken';
|
||||
static const String _baseUrlKey = 'baseUrl';
|
||||
static const String _apiKey = 'apiKey';
|
||||
static const String _moduleKey = 'moduleSelected';
|
||||
|
||||
final FlutterSecureStorage _secureStorage = FlutterSecureStorage();
|
||||
final HiveLocalStorage _localStorage = diCore.get<HiveLocalStorage>();
|
||||
|
||||
RxnString accessToken = RxnString();
|
||||
RxnString refreshToken = RxnString();
|
||||
RxnString baseurl = RxnString();
|
||||
Rxn<Module> appModule = Rxn(null);
|
||||
|
||||
Future<void> init() async {
|
||||
await Hive.initFlutter();
|
||||
Hive.registerAdapters();
|
||||
|
||||
final String? encryptedKey = await _secureStorage.read(key: 'hive_enc_key');
|
||||
final encryptionKey = encryptedKey != null
|
||||
? base64Url.decode(encryptedKey)
|
||||
: Hive.generateSecureKey();
|
||||
|
||||
if (encryptedKey == null) {
|
||||
await _secureStorage.write(key: 'hive_enc_key', value: base64UrlEncode(encryptionKey));
|
||||
}
|
||||
|
||||
await _localStorage.init();
|
||||
await _localStorage.openBox(_tokenBoxName, encryptionCipher: HiveAesCipher(encryptionKey));
|
||||
await _localStorage.openBox(_appBoxName);
|
||||
|
||||
accessToken.value = _localStorage.read<String?>(boxName: _tokenBoxName, key: _accessTokenKey);
|
||||
refreshToken.value = _localStorage.read<String?>(boxName: _tokenBoxName, key: _refreshTokenKey);
|
||||
appModule.value = _localStorage.read<Module?>(boxName: _appBoxName, key: _moduleKey);
|
||||
baseurl.value = _localStorage.read<String?>(boxName: _appBoxName, key: _baseUrlKey);
|
||||
}
|
||||
|
||||
Future<void> saveAccessToken(String token) async {
|
||||
await _localStorage.save(boxName: _tokenBoxName, key: _accessTokenKey, value: token);
|
||||
accessToken.value = token;
|
||||
accessToken.refresh();
|
||||
}
|
||||
|
||||
Future<void> saveRefreshToken(String token) async {
|
||||
await _localStorage.save(boxName: _tokenBoxName, key: _refreshTokenKey, value: token);
|
||||
refreshToken.value = token;
|
||||
refreshToken.refresh();
|
||||
}
|
||||
|
||||
Future<void> saveModule(Module input) async {
|
||||
await _localStorage.save(boxName: _tokenBoxName, key: _moduleKey, value: input);
|
||||
appModule.value = input;
|
||||
appModule.refresh();
|
||||
}
|
||||
|
||||
Future<void> deleteTokens() async {
|
||||
await _localStorage.clear(_tokenBoxName);
|
||||
accessToken.value = null;
|
||||
refreshToken.value = null;
|
||||
}
|
||||
|
||||
Future<void> saveBaseUrl(String url) async {
|
||||
await _localStorage.save(boxName: _appBoxName, key: _baseUrlKey, value: url);
|
||||
baseurl.value = url;
|
||||
baseurl.refresh();
|
||||
}
|
||||
|
||||
void getBaseUrl() {
|
||||
var url = _localStorage.read(boxName: _appBoxName, key: _baseUrlKey);
|
||||
baseurl.value = url;
|
||||
baseurl.refresh();
|
||||
}
|
||||
|
||||
Future<void> saveApiKey(String key) async {
|
||||
await _localStorage.save(boxName: _tokenBoxName, key: _apiKey, value: key);
|
||||
}
|
||||
}
|
||||
20
packages/core/lib/hive_registrar.g.dart
Normal file
20
packages/core/lib/hive_registrar.g.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
// Generated by Hive CE
|
||||
// Do not modify
|
||||
// Check in to version control
|
||||
|
||||
import 'package:hive_ce/hive.dart';
|
||||
import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart';
|
||||
|
||||
extension HiveRegistrar on HiveInterface {
|
||||
void registerAdapters() {
|
||||
registerAdapter(ModuleAdapter());
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
}
|
||||
}
|
||||
|
||||
extension IsolatedHiveRegistrar on IsolatedHiveInterface {
|
||||
void registerAdapters() {
|
||||
registerAdapter(ModuleAdapter());
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,26 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
import 'package:rasadyar_core/data/services/auth_middelware.dart';
|
||||
import 'package:rasadyar_core/infrastructure/local/hive_local_storage.dart';
|
||||
|
||||
final diCore = GetIt.instance;
|
||||
|
||||
Future<void> setupAllCoreProvider() async {
|
||||
diCore.registerSingleton(AuthMiddleware());
|
||||
await _setUpLogger();
|
||||
await _setupLocalStorage();
|
||||
await _setupRemote();
|
||||
await diCore.allReady();
|
||||
}
|
||||
|
||||
Future<void> _setUpLogger() async{
|
||||
Future<void> _setUpLogger() async {
|
||||
diCore.registerSingleton<Logger>(Logger());
|
||||
}
|
||||
|
||||
Future<void> _setupLocalStorage() async {
|
||||
diCore.registerSingleton<HiveLocalStorage>(HiveLocalStorage());
|
||||
print('====> HiveLocalStorage registered');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> _setupRemote() async {
|
||||
// diCore.registerSingleton<HiveLocalStorage>(HiveLocalStorage());
|
||||
// diCore.registerSingleton<HiveLocalStorage>(HiveLocalStorage());
|
||||
}
|
||||
|
||||
6
packages/core/lib/routing/auth_route_resolver.dart
Normal file
6
packages/core/lib/routing/auth_route_resolver.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart';
|
||||
|
||||
abstract class AuthRouteResolver {
|
||||
String getAuthRouteForModule(Module module);
|
||||
String getFallbackRoute();
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export 'resource.dart';
|
||||
export 'safe_call_utils.dart';
|
||||
export 'safe_call_utils.dart';
|
||||
export 'safe_call.dart';
|
||||
27
packages/core/lib/utils/network/safe_call.dart
Normal file
27
packages/core/lib/utils/network/safe_call.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Future<T?> safeCall<T>({
|
||||
required AppAsyncCallback<T> call,
|
||||
Function(T result)? onSuccess,
|
||||
ErrorCallback? onError,
|
||||
VoidCallback? onComplete,
|
||||
bool showLoading = false,
|
||||
bool showError = false,
|
||||
bool showSuccess = false,
|
||||
bool showToast = false,
|
||||
bool showSnackBar = false,
|
||||
Function()? onShowLoading,
|
||||
Function()? onHideLoading,
|
||||
}) {
|
||||
return gSafeCall<T>(
|
||||
call: call,
|
||||
onSuccess: onSuccess,
|
||||
onError: onError,
|
||||
onComplete: onComplete,
|
||||
showLoading: showLoading,
|
||||
showError: showError,
|
||||
showSuccess: showSuccess,
|
||||
onShowLoading: onShowLoading,
|
||||
onHideLoading: onHideLoading,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user