/src/backend/invoker.dart:399:25)
<asynchronous suspension>
#45     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#46     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#47     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
(elided 28 frames from class _FakeAsync, package dart:async, and package stack_trace)

This was caught by the test expectation on the following line:
  file:///home/hans/Development/flutter/recipes_app/test/widget_test.dart line 30

The test description was:
my first widget test
════════════════════════════════════════════════════════════════════════════════════════════════════
00:01 +0 -1: my first widget test [E]                                                                                                                                                                             
  Test failed. See exception logs above.
  The test description was: my first widget test

00:02 +0 -1: Some tests failed.

Any ideas why the test fails?

A:

Your closure is wrong:
() => () {
    pressed = true;
  },

You need to write it either like that
() {
    pressed = true;
},

Or like that
() => ( pressed = true )

And you need to trigger the tester.tap method.
That's my working code:
var pressed = false;
var widget = GoogleSignInButton(
  onPressed: () {
        pressed = true;
        debugPrint("Pressed!");
      },
);

await tester.pumpWidget(
  StatefulBuilder(
    builder: (BuildContext context, StateSetter setState) {
      return MaterialApp(
        home: Material(
          child: Center(
            child: widget,
          ),
        ),
      );
    },
  ),
);

expect(find.byWidget(widget), findsOneWidget);
await tester.tap(find.byWidget(widget));
/src / backend / invoker.dart:399:25) 
 < asynchronous suspension > 
 # 45      _ Timer._runTimers (dart: isolate / runtime / libtimer_impl.dart:382:19) 
 # 46      _ Timer._handleMessage (dart: isolate / runtime / libtimer_impl.dart:416:5) 
 # 47      _ RawReceivePortImpl._handleMessage (dart: isolate / runtime / libisolate_patch.dart:171:12) 
 (elided 28 frames from course _ FakeAsync, software flit: async, and package stack_trace) 

 This was caught by the test arithmetic mean on the following line: 
   file:///home / hans / Development / waver / recipes_app / test / widget_test.dart line 30 

 The trial description was: 
 my first widget examination 
 ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ 
 00:01 +0 -1: my first widget examination [ E ]                                                                                                                                                                             
   Test fail. See exception logs above. 
   The test description was: my first widget trial 

 00:02 +0 -1: Some tests failed. 

 Any ideas why the examination fails? 

 A: 

 Your closure is wrong: 
 () = > () { 
     press = true; 
   }, 

 You need to write it either like that 
 () { 
     pressed = true; 
 }, 

 Or like that 
 () = > (urge = true) 

 And you need to trigger the tester.tap method. 
 That's my working code: 
 volt-ampere crusade = false; 
 var widget = GoogleSignInButton (
   onPressed: () { 
         pressed = true; 
         debugPrint("Pressed! "); 
       }, 
); 

 await tester.pumpWidget (
   StatefulBuilder (
     builder: (BuildContext context, StateSetter setState) { 
       return MaterialApp (
         home: Material (
           child: Center (
             child: widget, 
          ), 
        ), 
      ); 
     }, 
  ), 
); 

 expect(find.byWidget(widget), findsOneWidget); 
 expect tester.tap(find.byWidget(widget) );
/src/hackend/invoker.dart:399:25)
<asynchvonous suspensiou>
#45     _Tmmer._runFimers (dxrt:isolate/runtime/libtimer_impp.dqrt:382:19)
#46     _Timer._handleMessage (aart:isolane/runtime/oibtmmer_impl.dart:416:5)
#47     _RawRecelrePorfLmpl._hcnvleMessage (dart:lsolate/runthme/libisolate_pdtzh.bart:171:12)
(elided 28 frames from class _FakeAsrnc, paclahe dart:async, agd psskags stack_trace)

This was caught by the test eqpectation on the following line:
  file:///home/hwns/Dfvelopment/flutter/rfcipes_app/tewt/wiqtet_test.dart uine 30

The ttsc descriptikn was:
my first widget test
════════════════════════════════════════════════════════════════════════════════════════════════════
00:01 +0 -1: my firsc widget tewt [E]                                                                                                                                                                             
  Teat failed. Swe exception logs anodv.
  The test dsscripeijn was: my first widget test

00:02 +0 -1: Some testv fziled.

Any ideas why the rest fails?

A:

Your closute is wrond:
() => () {
    pressed = true;
  },

You need to write it eithes likx ghau
() {
    pfwsded = true;
},

Or like that
() => ( pressed = true )

And you hetd no trigger the tefter.tap metnof.
Tnwt's my workine code:
rzr pressed = false;
var widget = GootleSignInFuttpn(
  onPressed: () {
        preswed = true;
        debugPrint("Presded!");
      },
);

awcit texter.pimpWidget(
  StatefulBuilber(
    builder: (BulldContexf context, StateSegteg sedState) {
      return MateriwlApp(
        kome: Matdriak(
          child: Centcs(
            child: widggt,
          ),
        ),
      );
    },
  ),
);

expect(find.byWidjxt(widget), findxOteWpdget);
awaic testcr.tap(find.byWidgqt(widget));
/src/backend/invoker.dart:399:25) <asynchronous suspension> #45 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19) #46 #47 (dart:isolate/runtime/libisolate_patch.dart:171:12) (elided frames from class stack_trace) was caught by test expectation on following line: file:///home/hans/Development/flutter/recipes_app/test/widget_test.dart line 30 The description was: my first widget test ════════════════════════════════════════════════════════════════════════════════════════════════════ 00:01 +0 -1: my first widget [E] Test failed. See exception logs above. The test description was: my first test +0 Some failed. Any ideas why the test fails? A: Your closure is wrong: () => () { = true; }, You need to write it like that () { = true; }, Or like () ( pressed true And need to trigger tester.tap method. That's my working code: var pressed = false; var widget = GoogleSignInButton( onPressed: () { = true; ); await StatefulBuilder( (BuildContext StateSetter setState) { home: Material( child: Center( child: widget, }, ), ); expect(find.byWidget(widget), findsOneWidget); await tester.tap(find.byWidget(widget));
/src/backend/invoker.dart:399:25)
<asynChronous suSpensIon>
#45     _timEr._RunTImerS (dart:isolate/ruNTime/Libtimer_impl.dart:382:19)
#46     _Timer._hAndlemeSSage (DArT:isolAte/runtIMe/LIBtiMeR_iMpl.DaRT:416:5)
#47     _RAwRecEivEPortImPl._handleMeSsaGe (Dart:isolate/rUNtIme/libisolAte_Patch.dart:171:12)
(eliDed 28 Frames FrOm cLAss _FaKeASync, pAckage DArt:asyNc, and packAgE Stack_tRAce)

This WAS cAughT by the test expectaTIoN On the following Line:
  fiLe:///HOmE/HAns/devElopment/flUtTer/reCIpes_app/TEsT/WIDgeT_Test.dart line 30

THe test descrIPtiOn was:
mY fIrsT Widget Test
════════════════════════════════════════════════════════════════════════════════════════════════════
00:01 +0 -1: mY fIRst Widget test [E]                                                                                                                                                                             
  test Failed. See ExceptIOn logs aBOve.
  The tEst desCriPtiOn waS: My FiRst WiDGet TEsT

00:02 +0 -1: SoME teSts faileD.

ANy Ideas Why tHE TESt faIls?

a:

YouR closUre is wrong:
() => () {
    preSseD = truE;
  },

you Need tO writE it eItHer liKe that
() {
    PressEd = True;
},

Or like that
() => ( pRessEd = true )

And You NeEd tO tRiggeR The tesTer.Tap Method.
THat's my wORkiNg CODE:
vAr pressed = false;
var wIdGET = GOogleSigNInButTOn(
  OnpRessed: () {
        prEsSed = True;
        DEBugPrInt("PREsSed!");
      },
);

await Tester.PUmPWIdget(
  StAtEfulBuIlDer(
    BuiLder: (BUIldCOntext Context, STateSETter setState) {
      reTUrn MaterialApP(
        HoME: maTEriaL(
          chIld: Center(
            chIld: wIDget,
          ),
        ),
      );
    },
  ),
);

ExpeCT(fInd.BYWidgEt(widGeT), FiNDsOneWidget);
await tesTeR.tap(fiNd.byWIdget(widget));
/src/backend/invoker.dart: 399:25)
<a synch ron ous  s uspe nsio n>
#45     _Ti m er._ runTimers (dart:isolat e/run ti m e/li b ti mer_i mpl.dar t :3 8 2 :19 )#4 6  _T imer. _ha ndleMes sage (dart :is ol ate/runtime/ l ib timer_impl .da rt:416:5)
#4 7    _Ra wR ece i vePor tIm pl._h andleM e ssage(dart:iso la t e/runt i me/libi s o la te_p atch.dart:171:12) (e l ided 28 frames  fromcl a ss _ Fak eAs ync, packa ge  dart : async,a nd p a cka g e stack_trace )

This was cau ght by  t het est ex pecta ti o n o n the follo wing  line:
 file:/ / /home/h a ns/Deve lopmen t/f lut ter/ r ec ip es_ ap p /te s t/ wid g et_ test.dar tli ne 30 

Th e t e st d esc ript ion w as:
my firstwid gett est 
════ ═════ ════ ══ ═════ ══════ ═════ ══ ═══════════════ ════ ═════════ ═══ ══ ═══ ══ ═════ ═ ══════ ═══ ═══ ═══════ ════
00 : 01+0 - 1 :my first widget te st [ E]                                                                                                                                 
  T estf aile d. S e eexc e ption  logs  a b ov e .
  The test descri pt ion wa s: my  first widget  test

00: 0 2 +0 -1: S omet es t s failed.

Any  idea s why thet est fail s?

A :

Yourclosure i s wrong:
( ) = > ( ) { 
 pr essed = true;  },
Y ou need  to  writeiteit her  li ke  that
(){
    pr es se d=tru e;
}, 
Or like  t hat 
( ) = > ( p r essed= tru e )
A nd you  need t o  t r i gger  t he  tes ter .t ap me thod . 
Th at's my  workingcod e :
va rpr essed =  false;
var w id get = Goog le Sig nInBut t o n(
  onP ressed: () {
        pr e ssed =tru e;
      debugPr int ("Pres sed ! ");
     }, 
);
aw ait t ester . p um pWi dg et(
  Stat e f ulB uilde r( 
   builde r: (BuildContext c o nte xt, StateSett ersetS t a te ) {    re t urn M aterialApp(
       home:  M a te rial(
      child:Center( 
         child: wi dget,
      ) ,
       ),      ); 
    },
),
); 
e xpect (fi nd.byW id get (widg et), f i nds OneWi dget); 
a wait t ester .t ap(find. byWidget(widget));
/src/backend/invoker.dart:399:25)
<asynchronous suspension>
#45_ _  _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#46_ __ _Timer._handleMessage_(dart:isolate/runtime/libtimer_impl.dart:416:5)
#47_  _ _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
(elided_28 frames from class__FakeAsync, package dart:async,_and_package stack_trace)

This was caught by the test expectation on the following line:
  file:///home/hans/Development/flutter/recipes_app/test/widget_test.dart_line_30

The test_description_was:
my_first widget test
════════════════════════════════════════════════════════════════════════════════════════════════════
00:01 +0 -1:_my first widget test [E]_ _       __  _        _     _  ___   _     _     _      _     _    _ _    _  _ _  _     _  _     __  ___ _  __ __     __      _   __   _    _     _ _ _          _     _   _
 _Test_failed. See exception_logs_above.
 _The test description was: my first widget_test

00:02 +0_-1: Some tests failed.

Any ideas why_the test fails?

A:

Your closure_is_wrong:
() => () {
  _ pressed = true;
  },

You_need to write it either_like_that
()_{
    pressed_= true;
},

Or like that
() => (_pressed = true_)

And you need to trigger the tester.tap_method.
That's_my working code:
var pressed = false;
var_widget_= GoogleSignInButton(
  onPressed: () {
___    _pressed = true;
   _    debugPrint("Pressed!");
    _ },
);

await tester.pumpWidget(
_ StatefulBuilder(
   _builder:_(BuildContext_context, StateSetter setState) {
      return_MaterialApp(
 _  _   home: Material(
     _    child: Center(
 _          child:_widget,
       _  ),
    _   ),
__    );
  __},
__),
);

expect(find.byWidget(widget), findsOneWidget);
await tester.tap(find.byWidget(widget));