feat : app version check in splash

This commit is contained in:
2025-07-20 11:31:23 +03:30
parent 1cfc6e2dbd
commit 3808161c88
9 changed files with 443 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'app_info_model.freezed.dart';
part 'app_info_model.g.dart';
@freezed
abstract class AppInfoModel with _$AppInfoModel {
const factory AppInfoModel({
required String key,
required Info info,
required String downloadLink,
}) = _AppInfoModel;
factory AppInfoModel.fromJson(Map<String, dynamic> json) =>
_$AppInfoModelFromJson(json);
}
@freezed
abstract class Info with _$Info {
const factory Info({
required String version,
required bool required,
required String module,
}) = _Info;
factory Info.fromJson(Map<String, dynamic> json) => _$InfoFromJson(json);
}

View File

@@ -0,0 +1,311 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'app_info_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AppInfoModel {
String get key; Info get info; String get downloadLink;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AppInfoModelCopyWith<AppInfoModel> get copyWith => _$AppInfoModelCopyWithImpl<AppInfoModel>(this as AppInfoModel, _$identity);
/// Serializes this AppInfoModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.info, info) || other.info == info)&&(identical(other.downloadLink, downloadLink) || other.downloadLink == downloadLink));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,info,downloadLink);
@override
String toString() {
return 'AppInfoModel(key: $key, info: $info, downloadLink: $downloadLink)';
}
}
/// @nodoc
abstract mixin class $AppInfoModelCopyWith<$Res> {
factory $AppInfoModelCopyWith(AppInfoModel value, $Res Function(AppInfoModel) _then) = _$AppInfoModelCopyWithImpl;
@useResult
$Res call({
String key, Info info, String downloadLink
});
$InfoCopyWith<$Res> get info;
}
/// @nodoc
class _$AppInfoModelCopyWithImpl<$Res>
implements $AppInfoModelCopyWith<$Res> {
_$AppInfoModelCopyWithImpl(this._self, this._then);
final AppInfoModel _self;
final $Res Function(AppInfoModel) _then;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = null,Object? info = null,Object? downloadLink = null,}) {
return _then(_self.copyWith(
key: null == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String,info: null == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info,downloadLink: null == downloadLink ? _self.downloadLink : downloadLink // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$InfoCopyWith<$Res> get info {
return $InfoCopyWith<$Res>(_self.info, (value) {
return _then(_self.copyWith(info: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _AppInfoModel implements AppInfoModel {
const _AppInfoModel({required this.key, required this.info, required this.downloadLink});
factory _AppInfoModel.fromJson(Map<String, dynamic> json) => _$AppInfoModelFromJson(json);
@override final String key;
@override final Info info;
@override final String downloadLink;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AppInfoModelCopyWith<_AppInfoModel> get copyWith => __$AppInfoModelCopyWithImpl<_AppInfoModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$AppInfoModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.info, info) || other.info == info)&&(identical(other.downloadLink, downloadLink) || other.downloadLink == downloadLink));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,info,downloadLink);
@override
String toString() {
return 'AppInfoModel(key: $key, info: $info, downloadLink: $downloadLink)';
}
}
/// @nodoc
abstract mixin class _$AppInfoModelCopyWith<$Res> implements $AppInfoModelCopyWith<$Res> {
factory _$AppInfoModelCopyWith(_AppInfoModel value, $Res Function(_AppInfoModel) _then) = __$AppInfoModelCopyWithImpl;
@override @useResult
$Res call({
String key, Info info, String downloadLink
});
@override $InfoCopyWith<$Res> get info;
}
/// @nodoc
class __$AppInfoModelCopyWithImpl<$Res>
implements _$AppInfoModelCopyWith<$Res> {
__$AppInfoModelCopyWithImpl(this._self, this._then);
final _AppInfoModel _self;
final $Res Function(_AppInfoModel) _then;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = null,Object? info = null,Object? downloadLink = null,}) {
return _then(_AppInfoModel(
key: null == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String,info: null == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info,downloadLink: null == downloadLink ? _self.downloadLink : downloadLink // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$InfoCopyWith<$Res> get info {
return $InfoCopyWith<$Res>(_self.info, (value) {
return _then(_self.copyWith(info: value));
});
}
}
/// @nodoc
mixin _$Info {
String get version; bool get required; String get module;
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$InfoCopyWith<Info> get copyWith => _$InfoCopyWithImpl<Info>(this as Info, _$identity);
/// Serializes this Info to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Info&&(identical(other.version, version) || other.version == version)&&(identical(other.required, required) || other.required == required)&&(identical(other.module, module) || other.module == module));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,version,required,module);
@override
String toString() {
return 'Info(version: $version, required: $required, module: $module)';
}
}
/// @nodoc
abstract mixin class $InfoCopyWith<$Res> {
factory $InfoCopyWith(Info value, $Res Function(Info) _then) = _$InfoCopyWithImpl;
@useResult
$Res call({
String version, bool required, String module
});
}
/// @nodoc
class _$InfoCopyWithImpl<$Res>
implements $InfoCopyWith<$Res> {
_$InfoCopyWithImpl(this._self, this._then);
final Info _self;
final $Res Function(Info) _then;
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? version = null,Object? required = null,Object? module = null,}) {
return _then(_self.copyWith(
version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String,required: null == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
as bool,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _Info implements Info {
const _Info({required this.version, required this.required, required this.module});
factory _Info.fromJson(Map<String, dynamic> json) => _$InfoFromJson(json);
@override final String version;
@override final bool required;
@override final String module;
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$InfoCopyWith<_Info> get copyWith => __$InfoCopyWithImpl<_Info>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$InfoToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Info&&(identical(other.version, version) || other.version == version)&&(identical(other.required, required) || other.required == required)&&(identical(other.module, module) || other.module == module));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,version,required,module);
@override
String toString() {
return 'Info(version: $version, required: $required, module: $module)';
}
}
/// @nodoc
abstract mixin class _$InfoCopyWith<$Res> implements $InfoCopyWith<$Res> {
factory _$InfoCopyWith(_Info value, $Res Function(_Info) _then) = __$InfoCopyWithImpl;
@override @useResult
$Res call({
String version, bool required, String module
});
}
/// @nodoc
class __$InfoCopyWithImpl<$Res>
implements _$InfoCopyWith<$Res> {
__$InfoCopyWithImpl(this._self, this._then);
final _Info _self;
final $Res Function(_Info) _then;
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? version = null,Object? required = null,Object? module = null,}) {
return _then(_Info(
version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String,required: null == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
as bool,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,33 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'app_info_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_AppInfoModel _$AppInfoModelFromJson(Map<String, dynamic> json) =>
_AppInfoModel(
key: json['key'] as String,
info: Info.fromJson(json['info'] as Map<String, dynamic>),
downloadLink: json['downloadLink'] as String,
);
Map<String, dynamic> _$AppInfoModelToJson(_AppInfoModel instance) =>
<String, dynamic>{
'key': instance.key,
'info': instance.info,
'downloadLink': instance.downloadLink,
};
_Info _$InfoFromJson(Map<String, dynamic> json) => _Info(
version: json['version'] as String,
required: json['required'] as bool,
module: json['module'] as String,
);
Map<String, dynamic> _$InfoToJson(_Info instance) => <String, dynamic>{
'version': instance.version,
'required': instance.required,
'module': instance.module,
};