-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Used @freezed to create Rating class #1669
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f0034e2
Use @freezed to create immutable Rating class
j-j-gajjar db9a723
Merge branch 'main' into main
j-j-gajjar 0a61cfd
Merge branch 'main' into main
j-j-gajjar 3627c14
explicitToJson true
j-j-gajjar b867e44
Merge branch 'main' into main
j-j-gajjar 25a8762
Merge branch 'main' into main
j-j-gajjar 93d9992
Merge branch 'main' into main
j-j-gajjar 3625ca7
Merge branch 'main' into main
j-j-gajjar 2b374e5
Run generate
spydon 6ebcc1c
Merge branch 'main' into main
spydon 101a57e
Don't prefix with common for rating
spydon b736036
Rating shouldn't be abstract
spydon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
packages/app_center_ratings_client/lib/src/ratings.freezed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
// 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 'ratings.dart'; | ||
|
||
// ************************************************************************** | ||
// FreezedGenerator | ||
// ************************************************************************** | ||
|
||
T _$identity<T>(T value) => value; | ||
|
||
final _privateConstructorUsedError = UnsupportedError( | ||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); | ||
|
||
/// @nodoc | ||
mixin _$Rating { | ||
String get snapId => throw _privateConstructorUsedError; | ||
int get totalVotes => throw _privateConstructorUsedError; | ||
RatingsBand get ratingsBand => throw _privateConstructorUsedError; | ||
|
||
@JsonKey(ignore: true) | ||
$RatingCopyWith<Rating> get copyWith => throw _privateConstructorUsedError; | ||
} | ||
|
||
/// @nodoc | ||
abstract class $RatingCopyWith<$Res> { | ||
factory $RatingCopyWith(Rating value, $Res Function(Rating) then) = | ||
_$RatingCopyWithImpl<$Res, Rating>; | ||
@useResult | ||
$Res call({String snapId, int totalVotes, RatingsBand ratingsBand}); | ||
} | ||
|
||
/// @nodoc | ||
class _$RatingCopyWithImpl<$Res, $Val extends Rating> | ||
implements $RatingCopyWith<$Res> { | ||
_$RatingCopyWithImpl(this._value, this._then); | ||
|
||
// ignore: unused_field | ||
final $Val _value; | ||
// ignore: unused_field | ||
final $Res Function($Val) _then; | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? snapId = null, | ||
Object? totalVotes = null, | ||
Object? ratingsBand = null, | ||
}) { | ||
return _then(_value.copyWith( | ||
snapId: null == snapId | ||
? _value.snapId | ||
: snapId // ignore: cast_nullable_to_non_nullable | ||
as String, | ||
totalVotes: null == totalVotes | ||
? _value.totalVotes | ||
: totalVotes // ignore: cast_nullable_to_non_nullable | ||
as int, | ||
ratingsBand: null == ratingsBand | ||
? _value.ratingsBand | ||
: ratingsBand // ignore: cast_nullable_to_non_nullable | ||
as RatingsBand, | ||
) as $Val); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
abstract class _$$RatingImplCopyWith<$Res> implements $RatingCopyWith<$Res> { | ||
factory _$$RatingImplCopyWith( | ||
_$RatingImpl value, $Res Function(_$RatingImpl) then) = | ||
__$$RatingImplCopyWithImpl<$Res>; | ||
@override | ||
@useResult | ||
$Res call({String snapId, int totalVotes, RatingsBand ratingsBand}); | ||
} | ||
|
||
/// @nodoc | ||
class __$$RatingImplCopyWithImpl<$Res> | ||
extends _$RatingCopyWithImpl<$Res, _$RatingImpl> | ||
implements _$$RatingImplCopyWith<$Res> { | ||
__$$RatingImplCopyWithImpl( | ||
_$RatingImpl _value, $Res Function(_$RatingImpl) _then) | ||
: super(_value, _then); | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? snapId = null, | ||
Object? totalVotes = null, | ||
Object? ratingsBand = null, | ||
}) { | ||
return _then(_$RatingImpl( | ||
snapId: null == snapId | ||
? _value.snapId | ||
: snapId // ignore: cast_nullable_to_non_nullable | ||
as String, | ||
totalVotes: null == totalVotes | ||
? _value.totalVotes | ||
: totalVotes // ignore: cast_nullable_to_non_nullable | ||
as int, | ||
ratingsBand: null == ratingsBand | ||
? _value.ratingsBand | ||
: ratingsBand // ignore: cast_nullable_to_non_nullable | ||
as RatingsBand, | ||
)); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
|
||
@JsonSerializable(explicitToJson: true) | ||
class _$RatingImpl implements _Rating { | ||
const _$RatingImpl( | ||
{required this.snapId, | ||
required this.totalVotes, | ||
required this.ratingsBand}); | ||
|
||
@override | ||
final String snapId; | ||
@override | ||
final int totalVotes; | ||
@override | ||
final RatingsBand ratingsBand; | ||
|
||
@override | ||
String toString() { | ||
return 'Rating(snapId: $snapId, totalVotes: $totalVotes, ratingsBand: $ratingsBand)'; | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
return identical(this, other) || | ||
(other.runtimeType == runtimeType && | ||
other is _$RatingImpl && | ||
(identical(other.snapId, snapId) || other.snapId == snapId) && | ||
(identical(other.totalVotes, totalVotes) || | ||
other.totalVotes == totalVotes) && | ||
(identical(other.ratingsBand, ratingsBand) || | ||
other.ratingsBand == ratingsBand)); | ||
} | ||
|
||
@override | ||
int get hashCode => Object.hash(runtimeType, snapId, totalVotes, ratingsBand); | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
@pragma('vm:prefer-inline') | ||
_$$RatingImplCopyWith<_$RatingImpl> get copyWith => | ||
__$$RatingImplCopyWithImpl<_$RatingImpl>(this, _$identity); | ||
} | ||
|
||
abstract class _Rating implements Rating { | ||
const factory _Rating( | ||
{required final String snapId, | ||
required final int totalVotes, | ||
required final RatingsBand ratingsBand}) = _$RatingImpl; | ||
|
||
@override | ||
String get snapId; | ||
@override | ||
int get totalVotes; | ||
@override | ||
RatingsBand get ratingsBand; | ||
@override | ||
@JsonKey(ignore: true) | ||
_$$RatingImplCopyWith<_$RatingImpl> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be an issue with nested
freezed
classes here - this is only part ofratings.dart
but notchart.dart
.Chart
is anotherfreezed
class, that has aRating
field.I don't know from the top of my head how to fix this, though.