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

Ignore plain getter #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
19 changes: 3 additions & 16 deletions example/lib/complete/complete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,8 @@ class FooSource extends SuperFooSource {
final List<FooNestedSource> list;
@override
final String superGet;
FooSource(
this.number,
this.text,
this.truthy,
this.named,
this.setterNumber,
this.property,
this.propertyTwo,
this.namedTwo,
this.list,
this.superGet,
String superText)
FooSource(this.number, this.text, this.truthy, this.named, this.setterNumber, this.property, this.propertyTwo,
this.namedTwo, this.list, this.superGet, String superText)
: super(superText);
}

Expand Down Expand Up @@ -92,10 +82,7 @@ class BarTarget {
}

BarTarget(this.numberDiff, this.text, this.truthy, this.superText,
{required this.named,
required this.namedTwoDiff,
required this.list,
required this.secondTextOther});
{required this.named, required this.namedTwoDiff, required this.list, required this.secondTextOther});
}

class BarNestedTarget {
Expand Down
26 changes: 17 additions & 9 deletions example/lib/complete/complete.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions example/lib/constructor/constructor.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion example/lib/field_mapping/field_mapping.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions example/lib/freezed/freezed_mapper.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions example/lib/function_mapping/function_mapping.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions example/lib/function_mapping/function_mapping_more.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:smartstruct/smartstruct.dart';
import 'package:smartstruct_example/function_mapping/function_utils.dart';

part 'function_mapping_more.mapper.g.dart';

// TARGET
Expand Down Expand Up @@ -33,14 +33,14 @@ class AgeHolderTarget {

// This is a more complex example.
// The toAgeHolderSource may return a "null" and the nested mapping "fromDogModel"
// is not accept "null".
// is not accept "null".
// So we need to invoke "toAgeHolderSource" and assign the
// return the a variable "tmp". And determine whether use the "nested mapping" by
// case that the value of "tmp" is null or not.
@Mapper()
abstract class DogMapper {
static String breedCustom(DogModel model) => 'customBreed';

@Mapping(source: fullNameWithAge, target: 'name')
@Mapping(source: breedCustom, target: 'breed')
@Mapping(source: toAgeHolderSource, target: 'model')
Expand All @@ -50,4 +50,4 @@ abstract class DogMapper {
}

String fullNameWithAge(DogModel model) => model.name + '${model.age}';
AgeHolderSource? toAgeHolderSource(DogModel model) => AgeHolderSource(model.age);
AgeHolderSource? toAgeHolderSource(DogModel model) => AgeHolderSource(model.age);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions example/lib/getter/getter_mapper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import 'package:smartstruct/smartstruct.dart';

part 'getter_mapper.mapper.g.dart';

class GetterTarget {
final String name;
final int age;

int foo = 0;

GetterTarget({
required this.name,
required this.age,
});

List<Object?> get props => [name, age];

bool get sample => false;
}

class GetterSource {
final String name;
final int age;

int foo = 1;

GetterSource({
required this.name,
required this.age,
});

List<Object?> get props => [name, age];

bool get sample => true;
}

@Mapper()
abstract class GetterMapper {
GetterTarget fromModel(GetterSource source);
}
21 changes: 21 additions & 0 deletions example/lib/getter/getter_mapper.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion example/lib/inheritance/inheritance.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions example/lib/injection/service_locator.config.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions example/lib/list/list.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions example/lib/list/nullable_list.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions example/lib/mapper_inheritance/mapper_inheritance.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions example/lib/multiple_sources/multiple_sources.mapper.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading