Commit 22210c8b authored by Adam Barth's avatar Adam Barth Committed by GitHub

Dispose AnimationController in examples (#5207)

These examples should show the best practices for working with
AnimationControllers.

Fixes #5206
parent 88536859
...@@ -227,6 +227,12 @@ class IsolateExampleState extends State<StatefulWidget> { ...@@ -227,6 +227,12 @@ class IsolateExampleState extends State<StatefulWidget> {
); );
} }
@override
void dispose() {
_animation.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Material( return new Material(
......
...@@ -23,6 +23,12 @@ class _SpinningSquareState extends State<SpinningSquare> { ...@@ -23,6 +23,12 @@ class _SpinningSquareState extends State<SpinningSquare> {
)..repeat(); )..repeat();
} }
@override
void dispose() {
_animation.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new RotationTransition( return new RotationTransition(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment