-
Notifications
You must be signed in to change notification settings - Fork 30
Description
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.