NotifyingVector2
in Flame
extends ChangeNotifier
.
What is the intended use case for this class?
Flame's documentation doesn't provide detailed information about Flutter's screen redraw mechanism. Since Flame inherently calls update
and render
multiple times, it seems there might be little reason to rely on Flutter's redraw mechanism in the first place. Could someone clarify this point?
There are two unrelated questions in this post, in the future you should try to do one post for each, to follow the StackOverflow guidelines.
NotifyingVector2 in Flame extends ChangeNotifier. What is the intended use case for this class?
It is so that you can listen to changes to the vector. Example:
component.position.addListener(
() => // Do something;
);
Since Flame inherently calls update and render multiple times, it seems there might be little reason to rely on Flutter's redraw mechanism in the first place. Could someone clarify this point?
Flame doesn't rely on Flutter's redraw mechanism, Flame is using the game loop architecture and relies on an implementation of that to know when to redraw.