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
2 changes: 1 addition & 1 deletion lib/src/equatable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ abstract class Equatable {
if (stringify ?? EquatableConfig.stringify) {
return mapPropsToString(runtimeType, props);
}
return '$runtimeType';
return super.toString();
}
}
2 changes: 1 addition & 1 deletion lib/src/equatable_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ mixin EquatableMixin {
if (stringify ?? EquatableConfig.stringify) {
return mapPropsToString(runtimeType, props);
}
return '$runtimeType';
return super.toString();
}
}
8 changes: 4 additions & 4 deletions test/equatable_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ void main() {
EquatableConfig.stringify = false;
expect(
Credentials(username: 'joe', password: 'pass').toString(),
'Credentials',
"Instance of 'Credentials'",
);
expect(
CredentialsMixin(username: 'joe', password: 'pass').toString(),
'CredentialsMixin',
"Instance of 'CredentialsMixin'",
);
});

Expand Down Expand Up @@ -113,15 +113,15 @@ void main() {
password: 'pass',
shouldStringify: false,
).toString(),
'Credentials',
"Instance of 'Credentials'",
);
expect(
CredentialsMixin(
username: 'joe',
password: 'pass',
shouldStringify: false,
).toString(),
'CredentialsMixin',
"Instance of 'CredentialsMixin'",
);
});
});
Expand Down
11 changes: 7 additions & 4 deletions test/equatable_mixin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void main() {
test('should correct toString when EquatableConfig.stringify is false', () {
EquatableConfig.stringify = false;
final instance = SimpleEquatable('simple');
expect(instance.toString(), 'SimpleEquatable<String>');
expect(instance.toString(), "Instance of 'SimpleEquatable<String>'");
});

test('should return true when instance is the same', () {
Expand Down Expand Up @@ -660,9 +660,12 @@ void main() {
ExplicitStringifyFalse(name: 'Bob', hairColor: Color.black);
final instanceC =
ExplicitStringifyFalse(name: 'Joe', age: 50, hairColor: Color.blonde);
expect(instanceA.toString(), 'ExplicitStringifyFalse');
expect(instanceB.toString(), 'ExplicitStringifyFalse');
expect(instanceC.toString(), 'ExplicitStringifyFalse');

const expected = "Instance of 'ExplicitStringifyFalse'";

expect(instanceA.toString(), expected);
expect(instanceB.toString(), expected);
expect(instanceC.toString(), expected);
});
});

Expand Down
11 changes: 7 additions & 4 deletions test/equatable_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void main() {
test('should correct toString when EquatableConfig.stringify is false', () {
EquatableConfig.stringify = false;
final instance = SimpleEquatable('simple');
expect(instance.toString(), 'SimpleEquatable<String>');
expect(instance.toString(), "Instance of 'SimpleEquatable<String>'");
});

test('should return true when instance is the same', () {
Expand Down Expand Up @@ -1057,9 +1057,12 @@ void main() {
age: 50,
hairColor: Color.blonde,
);
expect(instanceA.toString(), 'ExplicitStringifyFalse');
expect(instanceB.toString(), 'ExplicitStringifyFalse');
expect(instanceC.toString(), 'ExplicitStringifyFalse');

const expected = "Instance of 'ExplicitStringifyFalse'";

expect(instanceA.toString(), expected);
expect(instanceB.toString(), expected);
expect(instanceC.toString(), expected);
});
});
}
Expand Down