-
Notifications
You must be signed in to change notification settings - Fork 108
Description
(User reported this at dart-lang/mockito#425; mockito's code generation uses source_gen to revive parameter default values)
When trying to revive the default value of the curve
parameter of TabController.animateTo, ConstantReader.revive
gives back Cubic.ease
, which is not a real thing.
The default value of this parameter is Curves.ease
, declared as:
static const Cubic ease = Cubic(0.25, 0.1, 0.25, 1.0);
When I do some print-debugging, I see that reviveInstance
gets all the way down to checking fields, where clazz
is Cubic
and e
is Curves.ease
. So the result is Revivable._(source: ..., accessor: 'Cubic.ease')
(again, not a real thing).
I think the fix might be as easy as adjusting the for-loop here to hold on to t
, the type that e
is found on, and using that rather than clazz
.
As a stand-alone example, I have this:
class Foo {
void f({Bar a = Bars.b}) {}
}
class Bars {
static const Baz b = Baz();
}
class Bar {}
class Baz implements Bar {
const Baz();
}