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

Change 'bool operator ==(dynamic other))' to 'bool operator ==(Object other))' #20

Open
sbergmair opened this issue Feb 3, 2023 · 3 comments

Comments

@sbergmair
Copy link

sbergmair commented Feb 3, 2023

While using Mockito, there exists an error after running the build_runner concerning the override of the operator.
The override that is used in this package seems to be not correct, because in object.dart of the dart language there is an abstract method like this:
external bool operator ==(Object other);
I think that's why mockito does not find the correct implementation of this override.
There was also an discussion about this: dart-lang/mockito#479

Also consider: With this implementation its ok to compare Version and null; while Object specify the compared value not to be null.

@stefanschaller
Copy link

Fixed in : #21

@sanmadjack
Copy link
Contributor

I might be a bit behind, why wouldn't it be desirable to check if a version object is null?

@sbergmair
Copy link
Author

Since null safety, this is the correct override for the equals operator: https://api.dart.dev/stable/2.19.2/dart-core/Object/operator_equals.html

Before null safety, it's totally fine to check on null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants