spot icon indicating copy to clipboard operation
spot copied to clipboard

spot() vs act API

Open robiness opened this issue 2 years ago • 2 comments

Not reading any documentation of course and just wanting to kickstart using spot it feels counter intuitive to have spot(), creating an instance of spot and an act, which does not have an constructor. Does it make sense to you to make act() also valid?

I also would love to have an act() method on selectors so this would be interchangeable: await act.tap(spotSingle<ElevatedButton>()); await spotSingle<ElevatedButton>().tap();

Where the latter makes it way more discoverable and , for me at least, more intuitive.

This has probably already been thought of and the act API is about to , since overall the API feels nice and smooth.

robiness avatar Oct 20 '23 14:10 robiness

Fair request, I thought long about this.

I have the feeling that a .tap() would lead to many mistakes because it returns a Future and has to be awaited. You would most likely miss it every time you use it, right?

passsy avatar Oct 20 '23 15:10 passsy

Counter argument: "Code is read much more often than it is written, so plan accordingly" src. Thus we should design for readability.

One might argue that a chained tap() might be easier to write.

passsy avatar Dec 25 '23 16:12 passsy