You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Widget tests that contain ScreenUtilInit fail when using 5.9.0. Downgrading to 5.8.4 fixes the issue. Putting a tester.pumpAndSettle() after every tester.pumpWidget also solves the problem.
The test passes when SignPortraitScreen() does not use any screen utilities, with a value like height: 100, and fails when it has any value such as height: 100.h.
Error:
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following LateError was thrown building SignPortraitScreen(dirty):
LateInitializationError: Field '_splitScreenMode@289084504' has not been initialized.
The relevant error-causing widget was:
SignPortraitScreen
SignPortraitScreen:file:///Users/gus/Codigo/FlutterProjects/project/test/widgets/sign_screen_portrait_test.dart:11:15
When the exception was thrown, this was the stack:
#0 ScreenUtil._splitScreenMode (package:flutter_screenutil/src/screen_util.dart)
#1 ScreenUtil.scaleHeight (package:flutter_screenutil/src/screen_util.dart:204:8)
#2 ScreenUtil.setHeight (package:flutter_screenutil/src/screen_util.dart:225:44)
#3 SizeExtension.h (package:flutter_screenutil/src/size_extension.dart:12:32)
#4 SignPortraitScreen.build (package:story_creator/ui/screens/login/sign_portrait_screen.dart:33:31)
#5 StatelessElement.build (package:flutter/src/widgets/framework.dart:5541:49)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5471:15)
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching candidate
Actual: _KeyWidgetFinder:<Found 0 widgets with key [<'scaffold_sign_portrait'>]: []>
Which: means none were found but one was expected
When the exception was thrown, this was the stack:
#4 main.<anonymous closure> (file:///Users/gus/Codigo/FlutterProjects/project/test/widgets/sign_screen_portrait_test.dart:16:5)
<asynchronous suspension>
#5 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:168:15)
<asynchronous suspension>
#6 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1013:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
This was caught by the test expectation on the following line:
file:///Users/gus/Codigo/FlutterProjects/project/test/widgets/sign_screen_portrait_test.dart line 16
The test description was:
should sign screen widgets exist
════════════════════════════════════════════════════════════════════════════════════════════════════
Activity
Mounir-Bouaiche commentedon Aug 25, 2023
What kind of errors?
mleevi commentedon Aug 25, 2023
Finder does not find anything on the first pump (zero widgets found). After adding pumpAndsSettle after the initial pump fixes the errors.
Mounir-Bouaiche commentedon Aug 25, 2023
Put here a minimal code to reproduce the error.
mleevi commentedon Aug 25, 2023
Passes with 5.8.4, fails with 5.9.0:
Mounir-Bouaiche commentedon Aug 25, 2023
Well, that's unexpected. We're using Future in last version for the new change: ensureScreenSize as parameter. Thanks for reporting.
mleevi commentedon Sep 5, 2023
Is there any update on this? @Mounir-Bouaiche @techouse @lizhuoyuan @naivetoby
github-actions commentedon Oct 6, 2023
This issue is stale because it has been open for 30 days with no activity.
github-actions commentedon Oct 21, 2023
This issue was closed because it has been inactive for 14 days since being marked as stale.
ZG-123 commentedon Feb 1, 2024
Hello everyone, how did this work out in the end? I also encountered the same problem.
gustamor commentedon Feb 7, 2024
The same issue:
With the test:
The test passes when SignPortraitScreen() does not use any screen utilities, with a value like
height: 100, and fails when it has any value such asheight: 100.h.Error:
Always fails with:
Then:
Works fine with
tester.pumpAndSettle():MohiuddinM commentedon Mar 17, 2024
@gustamor @ZG-123 This issue has been fixed on master for quite some time, but unfortunately, maintainers did not have the time to make a release.
MohiuddinM commentedon Mar 17, 2024
@Mounir-Bouaiche Is it possible to make a release or is this package now unmaintained?
leventkantaroglu commentedon Mar 27, 2024
What you mean with "on master"? I couldn't see any commit on master branch.