If you need to create more than one AnimationController
over the lifetime of a State object,
use the TickerProviderStateMixin instead.

The SingleTickerProviderStateMixin is slightly more efficient
than TickerProviderStateMixin in the case of the class
only ever needing one Ticker.

2. Instantiate and dispose of AnimationController in lifecycle methods

Instantiate AnimationController in a widget lifecycle method,
and call the AnimationController.dispose() within the
State.dispose() lifecycle method:

{explicit2 → explicit3}/lib/main.dart

@@ -1,3 +1,5 @@

+
            // ignore_for_file: missing_required_argument

1
3

import 'dart:async';

2
4

import 'package:flutter/material.dart';