Closed danielgomezrico closed 11 months ago
Nah, that won't work, since mock objects have internal state. Like _realCalls
here https://github.com/dart-lang/mockito/blob/b4217750cbab5cdd2a773106abb476a7ea4aefb2/lib/src/mock.dart#L133, it is final
, but it can't be const
, since that will block us from adding anything to it.
(Not to mention your "Expected" code won't compile, since const constructor can't have bodies. But that's a solvable problem, the main issue is mocks are inherently not constant, so we shouldn't declare them as such).
Oh! got it, thanks for answering :)
Hi
Is there any way to make the generated Mock classes to have a
const
constructor by default? That may help to make all of the tests to run fasterCurrent
Expected
WIth a const constructor (just adding the const keyword on the constructor)