flutter_convenient_test icon indicating copy to clipboard operation
flutter_convenient_test copied to clipboard

Patch #337 needed anymore?

Open ahmdt opened this issue 1 year ago • 7 comments
trafficstars

Hi, is this message needed or can we create an workaround for newer flutter versions?

binding.runningAsyncTasks does not exist. Follow #337 to patch the code to get it.

ahmdt avatar Jan 26 '24 09:01 ahmdt

Hi, IIRC it is still needed, because Flutter did not merge the proposal (see https://github.com/flutter/flutter/issues/126545). However, feel free to PR to workaround it!

fzyzcjy avatar Jan 26 '24 10:01 fzyzcjy

Seems not to be continued on flutter side. What may be a good workaround approach?

ahmdt avatar Jan 26 '24 13:01 ahmdt

On one hand, you can workaround by manually patching as is suggested in #337. On the other hand, https://github.com/flutter/flutter/issues/126545 has some suggestions (e.g. subclass TestWidgetsFlutterBinding).

fzyzcjy avatar Jan 26 '24 13:01 fzyzcjy

How do you patch it, @fzyzcjy?

I've tried creating a duplicate of flutter_test to include this patch and then referenced it in pubspec with the path: ./patched_flutter_test argument, but that causes issues as many other dependencies, including flutter_convenient_test depend on the sdk version.

I'm also curious how difficult would it be to implement a fix in this project so that we don't have to go patching other libraries?

Tomburgs avatar Feb 23 '24 10:02 Tomburgs

I personally just modify the flutter framework code itself. (I use git patch apply and a small script, but any method works).

I'm also curious how difficult would it be to implement a fix in this project so that we don't have to go patching other libraries?

IIRC I examined it a little bit a long time ago and found some things may not work well, but to be honest I forgot what I tried (it may work indeed and just because I was too tired at that time). I will try to find some time to have a look at it later.

fzyzcjy avatar Feb 23 '24 11:02 fzyzcjy

Modifying the flutter code directly is a bit daunting 😬 Is there any way to make use of this library more seamless, such as a small bash script to modify the binding before/after each run or having a custom binding as suggested here? I am happy to help with this, just not sure where to start..

ghost avatar Apr 21 '24 01:04 ghost

I guess the first approach is possible (just some git-apply-patch things), and the second may also work. To get started on the first approach, maybe firstly play with git patch commands by hand and then create a script; for the second one, maybe firstly have a high-level overview of flutter testing bindings logic. Looking forward to your PR and feel free to ping me when need help!

fzyzcjy avatar Apr 21 '24 01:04 fzyzcjy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 21 '24 22:06 stale[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

github-actions[bot] avatar Jul 13 '24 06:07 github-actions[bot]