Skip to content
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.lock
.packages
.dart_tool
example/lib/*.g.dart
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: dart
dart:
- stable
- 2.5.2
- 2.7.0
script: ${TRAVIS_BUILD_DIR}/scripts/check-all --prepare
155 changes: 5 additions & 150 deletions example/lib/data_classes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ void main() {
}

@DataClass()
mixin Container<T> on _ContainerBase<T> {
mixin Container<T> {
String get id;
T get payload;
}

@SumType()
mixin Either<A, B> on _EitherBase<A, B> {
mixin Either<A, B> {
A get _left;
B get _right;
}
Expand All @@ -88,7 +88,7 @@ void foo(Either<String, int> x) {
}

@DataClass()
mixin User on _UserBase {
mixin User {
String get name;
Optional<int> get age;
KtList<User> get friends;
Expand All @@ -106,7 +106,7 @@ mixin User on _UserBase {
mixin NullaryType {}

@DataClass(toString: false)
mixin CustomToString on _CustomToStringBase {
mixin CustomToString {
String get foo;
String get bar;

Expand All @@ -116,7 +116,7 @@ mixin CustomToString on _CustomToStringBase {
}

@DataClass(eqHashCode: false)
mixin CustomEq on _CustomEqBase {
mixin CustomEq {
String get foo;
String get bar;

Expand All @@ -129,148 +129,3 @@ mixin CustomEq on _CustomEqBase {
return 42;
}
}

/*
// START generated code
abstract class UserFactory {
static User make({
@required String name,
int age,
@required KtList<User> friends,
@required ty.Address address,
ty.Address workAddress,
@required KtList<ty.Address> friendsAddresses,
}) {
return _User.make(
name: name,
age: Optional.of(age),
friends: friends,
address: address,
workAddress: Optional.of(workAddress),
friendsAddresses: friendsAddresses,
);
}
}

abstract class _UserBase {
_User copyWith(
{String name,
Optional<int> age,
KtList<User> friends,
ty.Address address,
Optional<ty.Address> workAddress,
KtList<ty.Address> friendsAddresses});
}

@immutable
class _User extends _UserBase with User {
final String name;
final Optional<int> age;
final KtList<User> friends;
final ty.Address address;
final Optional<ty.Address> workAddress;
final KtList<ty.Address> friendsAddresses;

// We cannot have a const constructor because of https://github.com/dart-lang/sdk/issues/37810
_User.make({
@required this.name,
@required this.age,
@required this.friends,
@required this.address,
@required this.workAddress,
@required this.friendsAddresses,
}) : assert(name != null),
assert(age != null),
assert(friends != null),
assert(address != null),
assert(workAddress != null),
assert(friendsAddresses != null);

_User copyWith(
{String name,
Optional<int> age,
KtList<User> friends,
ty.Address address,
Optional<ty.Address> workAddress,
KtList<ty.Address> friendsAddresses}) {
return _User.make(
name: name ?? this.name,
age: age ?? this.age,
friends: friends ?? this.friends,
address: address ?? this.address,
workAddress: workAddress ?? this.workAddress,
friendsAddresses: friendsAddresses ?? this.friendsAddresses,
);
}

bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
return (other is _User &&
this.runtimeType == other.runtimeType &&
this.name == other.name &&
this.age == other.age &&
this.friends == other.friends &&
this.address == other.address &&
this.workAddress == other.workAddress &&
this.friendsAddresses == other.friendsAddresses);
}

int get hashCode {
var result = 17;
result = 37 * result + this.name.hashCode;
result = 37 * result + this.age.hashCode;
result = 37 * result + this.friends.hashCode;
result = 37 * result + this.address.hashCode;
result = 37 * result + this.workAddress.hashCode;
result = 37 * result + this.friendsAddresses.hashCode;
return result;
}

String toString() {
return "User(name: ${this.name}, age: ${this.age}, friends: ${this.friends}, address: ${this.address}, workAddress: ${this.workAddress}, friendsAddresses: ${this.friendsAddresses})";
}
}

/// This data class has been generated from NullaryType
abstract class NullaryTypeFactory {
static NullaryType make() {
return _NullaryType.make();
}
}

abstract class _NullaryTypeBase {
_NullaryType copyWith();
}

@immutable
class _NullaryType extends _NullaryTypeBase with NullaryType {
// We cannot have a const constructor because of https://github.com/dart-lang/sdk/issues/37810
_NullaryType.make();

_NullaryType copyWith() {
return _NullaryType.make();
}

bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
return (other is _NullaryType &&
this.runtimeType == other.runtimeType &&
true);
}

int get hashCode {
var result = 17;

return result;
}

String toString() {
return "NullaryType()";
}
}
// END generated code
*/
Loading