mocktail icon indicating copy to clipboard operation
mocktail copied to clipboard

Mocktail 0.30 error on Flutter Beta, New Dart version Verify syntax

Open fredgrott opened this issue 2 years ago • 2 comments

just like the title states under Flutter beta 3.1.0.9 dart 2.18.0

Error only shows up under compiling while the IDE will give the error that the verify function is not defined. I only found the compilation error under running compile at tests coverage and that error is:

/D:/fluttersdk/myfluttersdk/flutter/.pub-cache/hosted/pub.dartlang.org/mocktail-0.3.0/lib/src/mocktail.dart:334:14: Error: Expected a function body or '=>'. Try adding {}. _Verify fy() =()> _makeVerify(false); ^ /D:/fluttersdk/myfluttersdk/flutter/.pub-cache/hosted/pub.dartlang.org/mocktail-0.3.0/lib/src/mocktail.dart:334:16: Error: Expected an identifier, but got ')'. Try inserting an identifier before ')'. _Verify fy() =()> _makeVerify(false); ^

Obviously its not a soft error but hard crash.

Given that Mocktail 0.2.0 had _Verify get verify => _makeVerify(false);

Workaround is to switch back to Mocktail 0.20 until fix

Those who use Mockingjay in conjunction with Mocktail would need to rollback to an earlier version of Mockingjay.

I do not know enough currently about the Mocktail 0.3.0 codebase and Mockito compat to know what the fix might be at the moment.

Not sure why no one else ran into the problem as it probably is showing up on flutter SDK stable as well.

fredgrott avatar Jun 24 '22 11:06 fredgrott

Hi @fredgrott 👋 Thanks for opening an issue!

Can you please provide a link to a minimal reproduction sample? Thanks!

felangel avatar Jun 24 '22 12:06 felangel

There was a linter change sometime in 2022.

Now official linter version is enforcing the no private types in public apis.

But that still does not explain why I can roll back to mocktail 0.2.0 as that version also uses a private type for the public verify method.

fredgrott avatar Jul 15 '22 23:07 fredgrott

Seems to hang on the _Verify get verify block IDE lists as function verify is not defined.

And I fix it by switching to Mocktail 0.2 and then the verify function is recognized.

fredgrott avatar Sep 29 '22 18:09 fredgrott

Just verified by reworking the basic bloc counter example

fredgrott avatar Sep 29 '22 18:09 fredgrott

@fredgrott can you provide a link to a minimal reproduction sample with reproduction steps? I'm not able to reproduce the error (the lint rule is something that will be addressed shortly but it shouldn't result in any compilation errors).

felangel avatar Sep 29 '22 18:09 felangel

Closing for now since there is no reproduction sample and it's been quite some time since this was created. Feel free to provide a reproduction sample if this is still an issue and I'm happy to reopen this.

felangel avatar Nov 16 '22 16:11 felangel