GravitySimulation class Null safety

A simulation that applies a constant accelerating force.

Models a particle that follows Newton's second law of motion. The simulation ends when the position reaches a defined point.

This method triggers an AnimationController (a previously constructed _controller field) to simulate a fall of 300 pixels.
void _startFall() {
    10.0, // acceleration, pixels per second per second
    0.0, // starting position, pixels
    300.0, // ending position, pixels
    0.0, // starting velocity, pixels per second

This AnimationController could be used with an AnimatedBuilder to animate the position of a child as if it was falling.

See also:



GravitySimulation(double acceleration, double distance, double endDistance, double velocity)
Creates a GravitySimulation using the given arguments, which are, respectively: an acceleration that is to be applied continually over time; an initial position relative to an origin; the magnitude of the distance from that origin beyond which (in either direction) to consider the simulation to be "done", which must be positive; and an initial velocity. [...]


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
tolerance Tolerance
How close to the actual end of the simulation a value at a particular time must be before isDone considers the simulation to be "done". [...]
read / write, inherited


dx(double time) double
The velocity of the object in the simulation at the given time.
isDone(double time) bool
Whether the simulation is "done" at the given time.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]
x(double time) double
The position of the object in the simulation at the given time.


operator ==(Object other) bool
The equality operator. [...]