Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix result data class #50

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions lib/src/models/package_score_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,26 @@ class Section with SectionMappable {

@MappableClass()
class Result with ResultMappable {
final String repositoryUrl;
final String issueTrackerUrl;
final Repository repository;
final int grantedPoints;
final int maxPoints;
final String? homepageUrl;
final String? repositoryUrl;
final String? issueTrackerUrl;
final String? documentationUrl;
final List<String>? fundingUrls;
final Repository? repository;
final String? contributingUrl;
final int? grantedPoints;
final int? maxPoints;

Result({
required this.repositoryUrl,
required this.issueTrackerUrl,
required this.repository,
required this.grantedPoints,
required this.maxPoints,
this.homepageUrl,
this.repositoryUrl,
this.issueTrackerUrl,
this.documentationUrl,
this.fundingUrls,
this.repository,
this.contributingUrl,
this.grantedPoints,
this.maxPoints,
});

static const fromMap = ResultMapper.fromMap;
Expand Down
94 changes: 70 additions & 24 deletions lib/src/models/package_score_card.mapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1246,36 +1246,56 @@ class ResultMapper extends ClassMapperBase<Result> {
@override
final String id = 'Result';

static String _$repositoryUrl(Result v) => v.repositoryUrl;
static String? _$homepageUrl(Result v) => v.homepageUrl;
static const Field<Result, String> _f$homepageUrl =
Field('homepageUrl', _$homepageUrl, opt: true);
static String? _$repositoryUrl(Result v) => v.repositoryUrl;
static const Field<Result, String> _f$repositoryUrl =
Field('repositoryUrl', _$repositoryUrl);
static String _$issueTrackerUrl(Result v) => v.issueTrackerUrl;
Field('repositoryUrl', _$repositoryUrl, opt: true);
static String? _$issueTrackerUrl(Result v) => v.issueTrackerUrl;
static const Field<Result, String> _f$issueTrackerUrl =
Field('issueTrackerUrl', _$issueTrackerUrl);
static Repository _$repository(Result v) => v.repository;
Field('issueTrackerUrl', _$issueTrackerUrl, opt: true);
static String? _$documentationUrl(Result v) => v.documentationUrl;
static const Field<Result, String> _f$documentationUrl =
Field('documentationUrl', _$documentationUrl, opt: true);
static List<String>? _$fundingUrls(Result v) => v.fundingUrls;
static const Field<Result, List<String>> _f$fundingUrls =
Field('fundingUrls', _$fundingUrls, opt: true);
static Repository? _$repository(Result v) => v.repository;
static const Field<Result, Repository> _f$repository =
Field('repository', _$repository);
static int _$grantedPoints(Result v) => v.grantedPoints;
Field('repository', _$repository, opt: true);
static String? _$contributingUrl(Result v) => v.contributingUrl;
static const Field<Result, String> _f$contributingUrl =
Field('contributingUrl', _$contributingUrl, opt: true);
static int? _$grantedPoints(Result v) => v.grantedPoints;
static const Field<Result, int> _f$grantedPoints =
Field('grantedPoints', _$grantedPoints);
static int _$maxPoints(Result v) => v.maxPoints;
Field('grantedPoints', _$grantedPoints, opt: true);
static int? _$maxPoints(Result v) => v.maxPoints;
static const Field<Result, int> _f$maxPoints =
Field('maxPoints', _$maxPoints);
Field('maxPoints', _$maxPoints, opt: true);

@override
final MappableFields<Result> fields = const {
#homepageUrl: _f$homepageUrl,
#repositoryUrl: _f$repositoryUrl,
#issueTrackerUrl: _f$issueTrackerUrl,
#documentationUrl: _f$documentationUrl,
#fundingUrls: _f$fundingUrls,
#repository: _f$repository,
#contributingUrl: _f$contributingUrl,
#grantedPoints: _f$grantedPoints,
#maxPoints: _f$maxPoints,
};

static Result _instantiate(DecodingData data) {
return Result(
homepageUrl: data.dec(_f$homepageUrl),
repositoryUrl: data.dec(_f$repositoryUrl),
issueTrackerUrl: data.dec(_f$issueTrackerUrl),
documentationUrl: data.dec(_f$documentationUrl),
fundingUrls: data.dec(_f$fundingUrls),
repository: data.dec(_f$repository),
contributingUrl: data.dec(_f$contributingUrl),
grantedPoints: data.dec(_f$grantedPoints),
maxPoints: data.dec(_f$maxPoints));
}
Expand Down Expand Up @@ -1326,11 +1346,16 @@ extension ResultValueCopy<$R, $Out> on ObjectCopyWith<$R, Result, $Out> {

abstract class ResultCopyWith<$R, $In extends Result, $Out>
implements ClassCopyWith<$R, $In, $Out> {
RepositoryCopyWith<$R, Repository, Repository> get repository;
ListCopyWith<$R, String, ObjectCopyWith<$R, String, String>>? get fundingUrls;
RepositoryCopyWith<$R, Repository, Repository>? get repository;
$R call(
{String? repositoryUrl,
{String? homepageUrl,
String? repositoryUrl,
String? issueTrackerUrl,
String? documentationUrl,
List<String>? fundingUrls,
Repository? repository,
String? contributingUrl,
int? grantedPoints,
int? maxPoints});
ResultCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);
Expand All @@ -1343,27 +1368,48 @@ class _ResultCopyWithImpl<$R, $Out> extends ClassCopyWithBase<$R, Result, $Out>
@override
late final ClassMapperBase<Result> $mapper = ResultMapper.ensureInitialized();
@override
RepositoryCopyWith<$R, Repository, Repository> get repository =>
$value.repository.copyWith.$chain((v) => call(repository: v));
ListCopyWith<$R, String, ObjectCopyWith<$R, String, String>>?
get fundingUrls => $value.fundingUrls != null
? ListCopyWith(
$value.fundingUrls!,
(v, t) => ObjectCopyWith(v, $identity, t),
(v) => call(fundingUrls: v))
: null;
@override
RepositoryCopyWith<$R, Repository, Repository>? get repository =>
$value.repository?.copyWith.$chain((v) => call(repository: v));
@override
$R call(
{String? repositoryUrl,
String? issueTrackerUrl,
Repository? repository,
int? grantedPoints,
int? maxPoints}) =>
{Object? homepageUrl = $none,
Object? repositoryUrl = $none,
Object? issueTrackerUrl = $none,
Object? documentationUrl = $none,
Object? fundingUrls = $none,
Object? repository = $none,
Object? contributingUrl = $none,
Object? grantedPoints = $none,
Object? maxPoints = $none}) =>
$apply(FieldCopyWithData({
if (repositoryUrl != null) #repositoryUrl: repositoryUrl,
if (issueTrackerUrl != null) #issueTrackerUrl: issueTrackerUrl,
if (repository != null) #repository: repository,
if (grantedPoints != null) #grantedPoints: grantedPoints,
if (maxPoints != null) #maxPoints: maxPoints
if (homepageUrl != $none) #homepageUrl: homepageUrl,
if (repositoryUrl != $none) #repositoryUrl: repositoryUrl,
if (issueTrackerUrl != $none) #issueTrackerUrl: issueTrackerUrl,
if (documentationUrl != $none) #documentationUrl: documentationUrl,
if (fundingUrls != $none) #fundingUrls: fundingUrls,
if (repository != $none) #repository: repository,
if (contributingUrl != $none) #contributingUrl: contributingUrl,
if (grantedPoints != $none) #grantedPoints: grantedPoints,
if (maxPoints != $none) #maxPoints: maxPoints
}));
@override
Result $make(CopyWithData data) => Result(
homepageUrl: data.get(#homepageUrl, or: $value.homepageUrl),
repositoryUrl: data.get(#repositoryUrl, or: $value.repositoryUrl),
issueTrackerUrl: data.get(#issueTrackerUrl, or: $value.issueTrackerUrl),
documentationUrl:
data.get(#documentationUrl, or: $value.documentationUrl),
fundingUrls: data.get(#fundingUrls, or: $value.fundingUrls),
repository: data.get(#repository, or: $value.repository),
contributingUrl: data.get(#contributingUrl, or: $value.contributingUrl),
grantedPoints: data.get(#grantedPoints, or: $value.grantedPoints),
maxPoints: data.get(#maxPoints, or: $value.maxPoints));

Expand Down
Loading