createTicker method

  1. @override
Ticker createTicker(
  1. TickerCallback onTick

Creates a ticker with the given callback.

The kind of ticker provided depends on the kind of ticker provider.


Ticker createTicker(TickerCallback onTick) {
  assert(() {
    if (_ticker == null) {
      return true;
    throw FlutterError.fromParts(<DiagnosticsNode>[
      ErrorSummary('$runtimeType is a SingleTickerProviderStateMixin but multiple tickers were created.'),
      ErrorDescription('A SingleTickerProviderStateMixin can only be used as a TickerProvider once.'),
        'If a State is used for multiple AnimationController objects, or if it is passed to other '
        'objects and those objects might use it more than one time in total, then instead of '
        'mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.',
  _ticker = Ticker(onTick, debugLabel: kDebugMode ? 'created by ${describeIdentity(this)}' : null);
  _updateTicker(); // Sets _ticker.mute correctly.
  return _ticker!;