Particle class

Base class implementing common behavior for all the particles.

Intention is to follow same "Extreme Composability" style as across the whole Flutter framework, so each type of particle implements some particular behavior which then could be nested and combined together to create specifically required experience.



Particle({double lifespan})


hashCode int
The hash code for this object. [...]
read-only, inherited
progress double
Getter which should be used by subclasses to get overall progress. Also allows to substitute progres with other values, for example adding easing as in CurvedParticle.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


accelerated({Offset acceleration =, Offset position =, Offset speed =}) Particle
Wraps this particle with AcceleratedParticle allowing to specify desired position speed and acceleration and leave the basic physics do the rest.
asComponent() Component
Wraps this particle with ParticleComponent to be used within the BaseGame component system.
destroy() bool
This method will return true as soon as particle reaches an end of its lifespan, which means it's ready to be destroyed by a wrapping container. Follows same style as Component.
moving({Offset from =, Offset to, Curve curve = Curves.linear}) Particle
Wraps this particle with MovingParticle allowing it to move from one Offset on the canvas to another one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
render(Canvas canvas) → void
Should render this Particle to given Canvas. Default behavior is empty, so that it's not required to override this in Particle which render nothing and serve as behavior containers.
rotated([double angle = 0]) Particle
Rotates this particle to a fixed angle in radians with RotatingParticle
rotating({double from = 0, double to = pi}) Particle
Rotates this particle from given angle to another one in radians with RotatingParticle
scaled(double scale) Particle
Wraps this particle with ScaledParticle allowing to change size of it and/or its children
setLifespan(double lifespan) → void
A control method allowing a parent of this Particle to pass down it's lifespan. Allows to only specify desired lifespan once, at the very top of the Particle tree which then will be propagated down using this method. See SingleChildParticle or ComposedParticle for details.
toString() String
A string representation of this object. [...]
translated(Offset offset) Particle
Wtaps this particle with TranslatedParticle statically repositioning it for the time of the lifespan.
update(double dt) → void
Updates internal Timer of this Particle which defines its position on the lifespan. Marks Particle for destroy when it is over.


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

Static Methods

generate({int count = 10, ParticleGenerator generator, double lifespan}) Particle
Generates given amount of particles, combining them into one ComposedParticle Useful for procedural particle generation.