How to initialize ScreenUtil.init() in flutter test? - flutter
For the BMI app created in flutter, I am writing a test, so when I run the test I am getting this below error:
═╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═
The following assertion was thrown building home_screen(dirty, state: _home_screenState#60944):
Ensure to initialize ScreenUtil before accessing it.
Please execute the init method : ScreenUtil.init()
'package:flutter_screenutil/screen_util.dart':
Failed assertion: line 32 pos 7: '_instance != null'
The relevant error-causing widget was:
home_screen file:///C:/Users/bmi/test/test.dart:14:32
When the exception was thrown, this was the stack:
#2 new ScreenUtil (package:flutter_screenutil/screen_util.dart:32:7)
#3 _home_screenState.build (package:bmi/ui_screen/HomeScreen.dart:54:22)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
#6 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4667:11)
#7 Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
#8 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4474:5)
#9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4658:11)
#10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4469:5)
#11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#12 Element.updateChild (package:flutter/src/widgets/framework.dart:3303:20)
#13 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1182:16)
#14 RenderObjectToWidgetElement.update (package:flutter/src/widgets/binding.dart:1160:5)
#15 RenderObjectToWidgetElement.performRebuild (package:flutter/src/widgets/binding.dart:1174:7)
#16 Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
#17 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2694:33)
#18 AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:1102:19)
#19 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#20 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#21 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#22 AutomatedTestWidgetsFlutterBinding.pump.<anonymous closure> (package:flutter_test/src/binding.dart:969:9)
#25 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:72:41)
#26 AutomatedTestWidgetsFlutterBinding.pump (package:flutter_test/src/binding.dart:956:27)
#27 WidgetTester.pumpWidget.<anonymous closure> (package:flutter_test/src/widget_tester.dart:522:22)
#30 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:72:41)
#31 WidgetTester.pumpWidget (package:flutter_test/src/widget_tester.dart:519:27)
#32 main.<anonymous closure> (file:///C:/Users/bmi/test/test.dart:14:21)
#33 main.<anonymous closure> (file:///C:/Users/bmi/test/test.dart:12:32)
#34 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:144:29)
<asynchronous suspension>
<asynchronous suspension>
(elided 7 frames from class _AssertionError, dart:async, and package:stack_trace)
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞══
The following TestFailure object was thrown running a test:
Expected: exactly 2 matching nodes in the widget tree
Actual: _WidgetTypeFinder:<zero widgets with type "GestureDetector" (ignoring offstage widgets)>
Which: means none were found but some were expected
When the exception was thrown, this was the stack:
#4 main.<anonymous closure> (file:///C:/Users/bmi/test/test.dart:17:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
...
This was caught by the test expectation on the following line:
file:///C:/Users/bmi/test/test.dart line 17
The test description was:
age increment
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞══
The following message was thrown:
Multiple exceptions (2) were detected during the running of the current test, and at least one was
unexpected.
Test failed. See exception logs above.
The test description was: age increment
This is my flutter test code:
import 'package:bmi_app_one/ui_screen/HomeScreen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main(){
TestWidgetsFlutterBinding.ensureInitialized();
testWidgets('age increment', (WidgetTester ageTester) async {
await ageTester.pumpWidget(home_screen());
// To verify that age counter starts at 20
expect(find.byType(GestureDetector), findsNWidgets(2));
expect(find.text('0'), findsNothing);
});
}
I tried to initialize it like this but got the same error:
setUpAll(() async{
TestWidgetsFlutterBinding.ensureInitialized();
await ScreenUtilInit();
});
tried googling it but couldn't find how to initialize ScreenUtil() in the flutter test. Any help would be appreciated.
I faced the same issue, all what I did is that, wrap your home_screen with ScreenUtilInit:
await tester.pumpWidget(
MaterialApp(
home: ScreenUtilInit(
designSize: Size(360, 690),
allowFontScaling: false,
child: home_screen(),
)),
);
Related
Navigator.pop(context,result) ERROR : type 'user' is not a subtype of type 'bool?' of 'result'
I want to pass an object by closing the interface I did navigator.pop(context , result) but I have this error ======== Exception caught by gesture =============================================================== The following _TypeError was thrown while handling a gesture: type 'User' is not a subtype of type 'bool?' of 'result' When the exception was thrown, this was the stack: #0 LocalHistoryRoute.didPop (package:flutter/src/widgets/routes.dart) #1 _RouteEntry.handlePop (package:flutter/src/widgets/navigator.dart:2896:16) #2 NavigatorState._flushHistoryUpdates (package:flutter/src/widgets/navigator.dart:3868:22) #3 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:4910:7) #4 Navigator.pop (package:flutter/src/widgets/navigator.dart:2432:27) #5 _DistributeurListState.build.. (package:electrosteel_project/widget/point_de_vente/distributeur_list.dart:312:39) #6 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:1005:21) #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24) #8 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:613:11) #9 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:298:5) #10 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:269:7) #11 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27) #12 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:449:20) #13 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:425:22) #14 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:329:11) #15 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:380:7) #16 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:344:5) #17 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:302:7) #18 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:285:7) #22 _invoke1 (dart:ui/hooks.dart:170:10) #23 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:331:7) #24 _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31) (elided 3 frames from dart:async) Handler: "onTap" Recognizer: TapGestureRecognizer#b4118 debugOwner: GestureDetector state: ready won arena finalPosition: Offset(150.9, 333.7) finalLocalPosition: Offset(150.9, 93.0) button: 1 sent tap down onTap: () { Navigator.pop(context,userList[index]); },
You are assigning PointdeVente object to bool object I think you're using like this bool? result = await Navigator.of(context).pushNamed(YourScreen.route): and in YourScreen you pop like this Navigator.pop(context,PointdeVente()); You have to do something like this. Example: PointdeVente? result = await Navigator.of(context).pushNamed(YourScreen.route): if you are expecting PointdeVente then you should pop like this in YourScreen Navigator.pop(context,PointdeVente());
hydrated_bloc: Unhandled Exception: Null check operator used on a null value
I am trying to use the hydrated_bloc package to persist a Bloc state. I already setup everything but when I try to initialize the HydratedStorage, I get an error saying Null check operator used on a null value This is the initialization code. HydratedBloc.storage = await HydratedStorage.build( storageDirectory: await getTemporaryDirectory(), ); This is the full stack trace [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value #0 MethodChannel.binaryMessenger package:flutter/…/services/platform_channel.dart:121 #1 MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart:146 #2 MethodChannel.invokeMethod package:flutter/…/services/platform_channel.dart:329 #3 MethodChannelPathProvider.getApplicationDocumentsPath package:path_provider_platform_interface/src/method_channel_path_provider.dart:50 #4 getApplicationDocumentsDirectory package:path_provider/path_provider.dart:138 #5 main package:main.dart:50 #6 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:145:25) #7 _rootRun (dart:async/zone.dart:1428:13) #8 _CustomZone.run (dart:async/zone.dart:1328:19) #9 _runZoned (dart:async/zone.dart:1863:10) #10 runZonedGuarded (dart:async/zone.dart:1851:12) #11 _runMainZoned.<anonymous closure> (<…> Reloaded 1 of 1651 libraries in 1,207ms.
testing dart code in android studio (no widgets involved, only data structures and concepts)
I want to run this code in android studio. I got the entire file from this webpage: https://flutter.dev/docs/cookbook/persistence/sqlite. I have the pubspec.yaml packages already set up, but I'm getting errors. Here's the widget_test.dart file that came by default. I commented out the await tester.pumpWidget(myApp()); because myApp() is no longer defined. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:sqlite_example/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. // await tester.pumpWidget(myApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); } error message: Testing started at 23:12 ... /Users/leozhang/flutter/bin/flutter --no-color test --machine test/widget_test.dart ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ The following TestFailure object was thrown running a test: Expected: exactly one matching node in the widget tree Actual: _TextFinder:<zero widgets with text "0" (ignoring offstage widgets)> Which: means none were found but one was expected When the exception was thrown, this was the stack: #4 main.<anonymous closure> (file:///Users/leozhang/Desktop/DesktopStuff/flutter_playground_files/sqlite_example/test/widget_test.dart:19:5) #5 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:124:25) #6 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:696:19) <asynchronous suspension> #9 TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:679:14) #10 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1050:24) #16 AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:1047:15) #17 testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:121:22) #18 Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:171:27) <asynchronous suspension> #19 Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:242:15) #24 Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:239:5) #25 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:169:33) #30 Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:13) #31 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:392:25) #45 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19) #46 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5) #47 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12) (elided 28 frames from class _FakeAsync, package dart:async, package dart:async-patch, and package stack_trace) This was caught by the test expectation on the following line: file:///Users/leozhang/Desktop/DesktopStuff/flutter_playground_files/sqlite_example/test/widget_test.dart line 19 The test description was: Counter increments smoke test ════════════════════════════════════════════════════════════════════════════════════════════════════ Test failed. See exception logs above. The test description was: Counter increments smoke test my main.dart just has the entire code from the website I mentioned earlier. Thanks for reading!
The issue here is that you're running Widget tests with testWidgets() function. To run tests without widgets, you can run unit tests using test() function as demonstrated on this guide.
The issue here is that you commented out the part that which widget tester pumps the widget. Without pumping the widget for the test we can't run a test. Just uncomment the part. await tester.pumpWidget(MyApp()); And one more thing you cannot test an app which doesn't have any widgets. That's what you are doing here. Commenting out the pumpwidget is a bad thing. If you don't have MyApp then change it to the page name you have. Like HOMEPAGE, COUNTERPAGE, etc. Hope you understood
How should use flutter_web_test package to run unit test on flutter_web project?
I have been exploring the flutter web for a while, everything is fine. But I have problems in creating unit test (StatelessWidget test for example) for flutter_web components. I have discover that there is a packages called flutter_web_test but it seems didn't work well. test code as follow: I have install test packages used by flutter_web demo projects: flutter_web_test // import fluter import 'package:flutter_web_test/flutter_web_test.dart'; // a stateless widget is imported import 'package:ies2.pms/views/main.dart'; void main() { testWidgets( 'test whether ', (WidgetTester tester) async { // very simple code, create widget in test await tester.pumpWidget(CYFCustomView(name: 'aaa')); print('aaa'); }, ); } Then I start running with flutter test Then I have received following errors: Failed to load test harness. Are you missing a dependency on flutter_test? 00:05 +0: loading /Users/yifan.chen/ByteDanceIES/pms/test/main_test.dart Unhandled exception: FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Aflutter_test%2Fflutter_test.dart; message=StandardFileSystem only supports file:* and data:* URIs) #0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7) #1 asFileUri (package:vm/kernel_front_end.dart:601:37) <asynchronous suspension> #2 FrontendCompiler._outputDependenciesDelta (package:vm/frontend_server.dart:401:39) <asynchronous suspension> #3 FrontendCompiler.compile (package:vm/frontend_server.dart:375:13) <asynchronous suspension> #4 _FlutterFrontendCompiler.compile (package:frontend_server/server.dart:31:22) <asynchronous suspension> #5 listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:736:26) <asynchronous suspension> #6 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10) #7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11) #8 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7) #9 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11) #10 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11) #11 _StringAdapterSink.add (dart:convert/string_conversion.dart:236:11) #12 _LineSplitterSink._addLines (dart:convert/line_splitter.dart:150:13) #13 _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:125:5) #14 StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5) #15 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24) #16 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10) #17 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11) #18 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7) #19 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11) #20 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11) #21 _StringAdapterSink.add (dart:convert/string_conversion.dart:236:11) #22 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:241:7) #23 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:312:20) #24 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:305:5) #25 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18) #26 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24) #27 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10) #28 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11) #29 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7) #30 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19) #31 _StreamController._add (dart:async/stream_controller.dart:640:7) #32 _StreamController.add (dart:async/stream_controller.dart:586:5) #33 _Socket._onData (dart:io-patch/socket_patch.dart:1786:41) #34 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10) #35 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11) #36 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7) #37 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19) #38 _StreamController._add (dart:async/stream_controller.dart:640:7) #39 _StreamController.add (dart:async/stream_controller.dart:586:5) #40 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1335:33) #41 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:856:14) #42 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) #43 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) #44 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13) #45 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5) 00:05 +0 -1: loading /Users/yifan.chen/ByteDanceIES/pms/test/main_test.dart [E] I can't find any solutions in Stackoverflow. And flutter_web currently haven't open issues yet. I have only discovered an issue in flutter, saying that flutter test is not supported for flutter_web project. How should I run unit test on flutter_web project ? They have built flutter_web_test package, so it is supposed to be functional.
you shoukd move to flutter 1.9, flutter_web is deprecrated https://flutter.dev/web, the shorter way is update flutter to 1.9, create a new fresh project and activate web on it: flutter run -d chrome now you can build with flutter build web. I hope it solves your problems.
error when depoloy flutter project with CodeMagic
i have an flutter project and it is run good on emulator and my android device, but when i upload it to Github and make (commit) show me this error to review: i cannot do anything about this error, and it is not affect my project when run it? and when i ignore it and deploy to GitHub and try to build and deploy project with CodeMagic, i faced this error in (Running Test) step : == Testing == == flutter test --machine == {"protocolVersion":"0.1.1","runnerVersion":null,"pid":2836,"type":"start","time":0} {"suite":{"id":0,"platform":"vm","path":"/Users/greenhouse/clone/test/widget_test.dart"},"type":"suite","time":1} {"test":{"id":1,"name":"loading /Users/greenhouse/clone/test/widget_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":2} {"count":1,"type":"allSuites","time":10} {"group":{"id":2,"suiteID":0,"parentID":null,"name":null,"metadata":{"skip":false,"skipReason":null},"testCount":1,"line":null,"column":null,"url":null},"type":"group","time":9907} {"test":{"id":3,"name":"Counter increments smoke test","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":76,"column":3,"url":"package:flutter_test/src/widget_tester.dart","root_line":14,"root_column":3,"root_url":"file:///Users/greenhouse/clone/test/widget_test.dart"},"type":"testStart","time":9909} {"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":9916} {"testID":3,"messageType":"print","message":"══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════","type":"print","time":10433} {"testID":3,"messageType":"print","message":"The following assertion was thrown building MisSplash(state: _OneState#0408f(ticker active)):\nMediaQuery.of() called with a context that does not contain a MediaQuery.\nNo MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of().\nThis can happen because you do not have a WidgetsApp or MaterialApp widget (those widgets introduce\na MediaQuery), or it can happen if the context you use comes from a widget above those widgets.\nThe context used was:\n Scaffold(dirty, state: ScaffoldState#1ae2e(lifecycle state: initialized, tickers: tracking 1\n ticker))","type":"print","time":10438} {"testID":3,"messageType":"print","message":"\nWhen the exception was thrown, this was the stack:","type":"print","time":10439} {"testID":3,"messageType":"print","message":"#0 MediaQuery.of (package:flutter/src/widgets/media_query.dart:528:5)","type":"print","time":10450} {"testID":3,"messageType":"print","message":"#1 ScaffoldState.didChangeDependencies (package:flutter/src/material/scaffold.dart:1529:50)","type":"print","time":10451} {"testID":3,"messageType":"print","message":"#2 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3862:12)","type":"print","time":10451} {"testID":3,"messageType":"print","message":"#3 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3711:5)","type":"print","time":10452} {"testID":3,"messageType":"print","message":"#4 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2956:14)","type":"print","time":10453} {"testID":3,"messageType":"print","message":"#5 Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)","type":"print","time":10453} {"testID":3,"messageType":"print","message":"#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3747:16)","type":"print","time":10453} {"testID":3,"messageType":"print","message":"#7 Element.rebuild (package:flutter/src/widgets/framework.dart:3559:5)","type":"print","time":10453} {"testID":3,"messageType":"print","message":"#8 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3716:5)","type":"print","time":10454} {"testID":3,"messageType":"print","message":"#9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)","type":"print","time":10454} {"testID":3,"messageType":"print","message":"#10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3711:5)","type":"print","time":10455} {"testID":3,"messageType":"print","message":"#11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2956:14)","type":"print","time":10455} {"testID":3,"messageType":"print","message":"#12 Element.updateChild (package:flutter/src/widgets/framework.dart:2759:12)","type":"print","time":10456} {"testID":3,"messageType":"print","message":"#13 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:933:16)","type":"print","time":10456} {"testID":3,"messageType":"print","message":"#14 RenderObjectToWidgetElement.update (package:flutter/src/widgets/binding.dart:911:5)","type":"print","time":10457} {"testID":3,"messageType":"print","message":"#15 RenderObjectToWidgetElement.performRebuild (package:flutter/src/widgets/binding.dart:925:7)","type":"print","time":10458} {"testID":3,"messageType":"print","message":"#16 Element.rebuild (package:flutter/src/widgets/framework.dart:3559:5)","type":"print","time":10458} {"testID":3,"messageType":"print","message":"#17 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2273:33)","type":"print","time":10459} {"testID":3,"messageType":"print","message":"#18 AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:805:18)","type":"print","time":10460} {"testID":3,"messageType":"print","message":"#19 _TestWidgetsFlutterBinding&BindingBase&ServicesBinding&SchedulerBinding&GestureBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:268:5)","type":"print","time":10461} {"testID":3,"messageType":"print","message":"#20 _TestWidgetsFlutterBinding&BindingBase&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)","type":"print","time":10462} {"testID":3,"messageType":"print","message":"#21 _TestWidgetsFlutterBinding&BindingBase&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:928:9)","type":"print","time":10462} {"testID":3,"messageType":"print","message":"#22 AutomatedTestWidgetsFlutterBinding.pump.<anonymous closure> (package:flutter_test/src/binding.dart:719:9)","type":"print","time":10463} {"testID":3,"messageType":"print","message":"#25 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:69:41)","type":"print","time":10465} {"testID":3,"messageType":"print","message":"#26 AutomatedTestWidgetsFlutterBinding.pump (package:flutter_test/src/binding.dart:706:27)","type":"print","time":10465} {"testID":3,"messageType":"print","message":"#27 WidgetTester.pumpWidget.<anonymous closure> (package:flutter_test/src/widget_tester.dart:250:22)","type":"print","time":10465} {"testID":3,"messageType":"print","message":"#30 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:69:41)","type":"print","time":10466} {"testID":3,"messageType":"print","message":"#31 WidgetTester.pumpWidget (package:flutter_test/src/widget_tester.dart:247:27)","type":"print","time":10466} {"testID":3,"messageType":"print","message":"#32 main.<anonymous closure> (file:///Users/greenhouse/clone/test/widget_test.dart:16:18)","type":"print","time":10467} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10467} {"testID":3,"messageType":"print","message":"#33 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:82:23)","type":"print","time":10468} {"testID":3,"messageType":"print","message":"#34 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:571:19)","type":"print","time":10469} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10469} {"testID":3,"messageType":"print","message":"#37 TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:555:14)","type":"print","time":10470} {"testID":3,"messageType":"print","message":"#38 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:898:24)","type":"print","time":10472} {"testID":3,"messageType":"print","message":"#44 AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:895:15)","type":"print","time":10473} {"testID":3,"messageType":"print","message":"#45 testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:81:22)","type":"print","time":10473} {"testID":3,"messageType":"print","message":"#46 Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:27)","type":"print","time":10474} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10474} {"testID":3,"messageType":"print","message":"#47 Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:250:15)","type":"print","time":10475} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10479} {"testID":3,"messageType":"print","message":"#52 Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:247:5)","type":"print","time":10479} {"testID":3,"messageType":"print","message":"#53 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:166:33)","type":"print","time":10479} {"testID":3,"messageType":"print","message":"#58 Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:165:13)","type":"print","time":10480} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10480} {"testID":3,"messageType":"print","message":"#59 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:400:25)","type":"print","time":10482} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10482} {"testID":3,"messageType":"print","message":"#73 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)","type":"print","time":10483} {"testID":3,"messageType":"print","message":"#74 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)","type":"print","time":10483} {"testID":3,"messageType":"print","message":"#75 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)","type":"print","time":10484} {"testID":3,"messageType":"print","message":"(elided 32 frames from class _FakeAsync, package dart:async, and package stack_trace)","type":"print","time":10485} {"testID":3,"messageType":"print","message":"════════════════════════════════════════════════════════════════════════════════════════════════════","type":"print","time":10485} {"testID":3,"messageType":"print","message":"══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════","type":"print","time":10486} {"testID":3,"messageType":"print","message":"The following TestFailure object was thrown running a test:\n Expected: exactly one matching node in the widget tree\n Actual: ?:<zero widgets with text \"0\" (ignoring offstage widgets)>\n Which: means none were found but one was expected","type":"print","time":10487} {"testID":3,"messageType":"print","message":"\nWhen the exception was thrown, this was the stack:","type":"print","time":10489} {"testID":3,"messageType":"print","message":"#4 main.<anonymous closure> (file:///Users/greenhouse/clone/test/widget_test.dart:19:5)","type":"print","time":10490} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10493} {"testID":3,"messageType":"print","message":"#5 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:82:23)","type":"print","time":10493} {"testID":3,"messageType":"print","message":"#6 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:571:19)","type":"print","time":10493} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10498} {"testID":3,"messageType":"print","message":"#9 TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:555:14)","type":"print","time":10498} {"testID":3,"messageType":"print","message":"#10 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:898:24)","type":"print","time":10498} {"testID":3,"messageType":"print","message":"#16 AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:895:15)","type":"print","time":10498} {"testID":3,"messageType":"print","message":"#17 testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:81:22)","type":"print","time":10498} {"testID":3,"messageType":"print","message":"#18 Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:27)","type":"print","time":10499} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10499} {"testID":3,"messageType":"print","message":"#19 Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:250:15)","type":"print","time":10499} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10499} {"testID":3,"messageType":"print","message":"#24 Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:247:5)","type":"print","time":10499} {"testID":3,"messageType":"print","message":"#25 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:166:33)","type":"print","time":10500} {"testID":3,"messageType":"print","message":"#30 Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:165:13)","type":"print","time":10500} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10500} {"testID":3,"messageType":"print","message":"#31 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:400:25)","type":"print","time":10501} {"testID":3,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":10501} {"testID":3,"messageType":"print","message":"#45 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)","type":"print","time":10501} {"testID":3,"messageType":"print","message":"#46 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)","type":"print","time":10501} {"testID":3,"messageType":"print","message":"#47 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)","type":"print","time":10502} {"testID":3,"messageType":"print","message":"(elided 28 frames from class _FakeAsync, package dart:async, and package stack_trace)","type":"print","time":10502} {"testID":3,"messageType":"print","message":"\nThis was caught by the test expectation on the following line:\n file:///Users/greenhouse/clone/test/widget_test.dart line 19\n\nThe test description was:\nCounter increments smoke test","type":"print","time":10504} {"testID":3,"messageType":"print","message":"════════════════════════════════════════════════════════════════════════════════════════════════════","type":"print","time":10505} {"testID":3,"messageType":"print","message":"══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════","type":"print","time":10505} {"testID":3,"messageType":"print","message":"The following message was thrown:\nMultiple exceptions (2) were detected during the running of the current test, and at least one was\nunexpected.","type":"print","time":10506} {"testID":3,"messageType":"print","message":"════════════════════════════════════════════════════════════════════════════════════════════════════","type":"print","time":10507} {"testID":3,"error":"Test failed. See exception logs above.\nThe test description was: Counter increments smoke test","stackTrace":"","isFailure":false,"type":"error","time":10518} {"testID":3,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":10521} {"success":false,"type":"done","time":10560} Tests failed :| Flutter test run failed == Tests failed, skip build == there is no error when i run the project? how can find the bugs?, and i try to read this log above, but i cannot understand the error?
Just Disable the test phase, this might work. Go to the workflow settings then to Test then uncheck both option for Run "Flutter test" and Stop the "Build if test Fails" Save it and try again. Hope it'll solve but you cannot test your app that's the drawback.