Description
From flame
, one can instantiate a component as follows:
textComponent = TextComponent(
text: counter.toString(),
textRenderer: _textPaint,
);
See implementation here.
For consistency, perhaps it would be nice to update forge2d API to also support this pattern. For example, with shapes. We could:
final shape = CircleShape(radius: radius);
instead of
final shape = CircleShape()
..radius = radius;
Additional Context
Personally, both can be seen as equivalent. I think both APIs should be supported (cascading and optional parameters). Besides consistency with flame
, one could also argue that using the positional parameter avoids setting/changing the value first unnecessary, since we already know its computed value and will change instantly after.
In addition, we also benefit from the analyser when we are setting default values.
This issue is open to discussion. If we decide to proceed I'm willing to contribute with this update.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too