feat : sale in provence
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'pagination_model.freezed.dart';
|
||||
part 'pagination_model.g.dart';
|
||||
|
||||
@Freezed(genericArgumentFactories: true)
|
||||
abstract class PaginationModel<T> with _$PaginationModel<T> {
|
||||
const factory PaginationModel({
|
||||
int? count,
|
||||
String? next,
|
||||
String? previous,
|
||||
List<T>? results,
|
||||
}) = _PaginationModel<T>;
|
||||
|
||||
factory PaginationModel.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
T Function(Object?) fromJsonT,
|
||||
) => _$PaginationModelFromJson(json, fromJsonT);
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// 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 'pagination_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaginationModel<T> {
|
||||
|
||||
int? get count; String? get next; String? get previous; List<T>? get results;
|
||||
/// Create a copy of PaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaginationModelCopyWith<T, PaginationModel<T>> get copyWith => _$PaginationModelCopyWithImpl<T, PaginationModel<T>>(this as PaginationModel<T>, _$identity);
|
||||
|
||||
/// Serializes this PaginationModel to a JSON map.
|
||||
Map<String, dynamic> toJson(Object? Function(T) toJsonT);
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PaginationModel<T>&&(identical(other.count, count) || other.count == count)&&(identical(other.next, next) || other.next == next)&&(identical(other.previous, previous) || other.previous == previous)&&const DeepCollectionEquality().equals(other.results, results));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,count,next,previous,const DeepCollectionEquality().hash(results));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaginationModel<$T>(count: $count, next: $next, previous: $previous, results: $results)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PaginationModelCopyWith<T,$Res> {
|
||||
factory $PaginationModelCopyWith(PaginationModel<T> value, $Res Function(PaginationModel<T>) _then) = _$PaginationModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int? count, String? next, String? previous, List<T>? results
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PaginationModelCopyWithImpl<T,$Res>
|
||||
implements $PaginationModelCopyWith<T, $Res> {
|
||||
_$PaginationModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PaginationModel<T> _self;
|
||||
final $Res Function(PaginationModel<T>) _then;
|
||||
|
||||
/// Create a copy of PaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? count = freezed,Object? next = freezed,Object? previous = freezed,Object? results = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
count: freezed == count ? _self.count : count // ignore: cast_nullable_to_non_nullable
|
||||
as int?,next: freezed == next ? _self.next : next // ignore: cast_nullable_to_non_nullable
|
||||
as String?,previous: freezed == previous ? _self.previous : previous // ignore: cast_nullable_to_non_nullable
|
||||
as String?,results: freezed == results ? _self.results : results // ignore: cast_nullable_to_non_nullable
|
||||
as List<T>?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable(genericArgumentFactories: true)
|
||||
|
||||
class _PaginationModel<T> implements PaginationModel<T> {
|
||||
const _PaginationModel({this.count, this.next, this.previous, final List<T>? results}): _results = results;
|
||||
factory _PaginationModel.fromJson(Map<String, dynamic> json,T Function(Object?) fromJsonT) => _$PaginationModelFromJson(json,fromJsonT);
|
||||
|
||||
@override final int? count;
|
||||
@override final String? next;
|
||||
@override final String? previous;
|
||||
final List<T>? _results;
|
||||
@override List<T>? get results {
|
||||
final value = _results;
|
||||
if (value == null) return null;
|
||||
if (_results is EqualUnmodifiableListView) return _results;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of PaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PaginationModelCopyWith<T, _PaginationModel<T>> get copyWith => __$PaginationModelCopyWithImpl<T, _PaginationModel<T>>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson(Object? Function(T) toJsonT) {
|
||||
return _$PaginationModelToJson<T>(this, toJsonT);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PaginationModel<T>&&(identical(other.count, count) || other.count == count)&&(identical(other.next, next) || other.next == next)&&(identical(other.previous, previous) || other.previous == previous)&&const DeepCollectionEquality().equals(other._results, _results));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,count,next,previous,const DeepCollectionEquality().hash(_results));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaginationModel<$T>(count: $count, next: $next, previous: $previous, results: $results)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PaginationModelCopyWith<T,$Res> implements $PaginationModelCopyWith<T, $Res> {
|
||||
factory _$PaginationModelCopyWith(_PaginationModel<T> value, $Res Function(_PaginationModel<T>) _then) = __$PaginationModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int? count, String? next, String? previous, List<T>? results
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PaginationModelCopyWithImpl<T,$Res>
|
||||
implements _$PaginationModelCopyWith<T, $Res> {
|
||||
__$PaginationModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PaginationModel<T> _self;
|
||||
final $Res Function(_PaginationModel<T>) _then;
|
||||
|
||||
/// Create a copy of PaginationModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? count = freezed,Object? next = freezed,Object? previous = freezed,Object? results = freezed,}) {
|
||||
return _then(_PaginationModel<T>(
|
||||
count: freezed == count ? _self.count : count // ignore: cast_nullable_to_non_nullable
|
||||
as int?,next: freezed == next ? _self.next : next // ignore: cast_nullable_to_non_nullable
|
||||
as String?,previous: freezed == previous ? _self.previous : previous // ignore: cast_nullable_to_non_nullable
|
||||
as String?,results: freezed == results ? _self._results : results // ignore: cast_nullable_to_non_nullable
|
||||
as List<T>?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'pagination_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_PaginationModel<T> _$PaginationModelFromJson<T>(
|
||||
Map<String, dynamic> json,
|
||||
T Function(Object? json) fromJsonT,
|
||||
) => _PaginationModel<T>(
|
||||
count: (json['count'] as num?)?.toInt(),
|
||||
next: json['next'] as String?,
|
||||
previous: json['previous'] as String?,
|
||||
results: (json['results'] as List<dynamic>?)?.map(fromJsonT).toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PaginationModelToJson<T>(
|
||||
_PaginationModel<T> instance,
|
||||
Object? Function(T value) toJsonT,
|
||||
) => <String, dynamic>{
|
||||
'count': instance.count,
|
||||
'next': instance.next,
|
||||
'previous': instance.previous,
|
||||
'results': instance.results?.map(toJsonT).toList(),
|
||||
};
|
||||
Reference in New Issue
Block a user