Skip to content

vsync is not detected as a named parameter in the AnimatedBuilder class #2793

@cverdes

Description

@cverdes

Copying and pasting the example of the AnimatedBuilder class documentation page the vsync paramameter is not recognized and detected as an error in this piece of code:

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      duration: const Duration(seconds: 10),
      vsync: this,
    )..repeat();
  }

as is shown in the following image:
bug

The constructor signature is interpreted by VSCode as:
bug2

but the definition in the animation_controller.dart file into the packages/flutter/lib/src/animation is:

AnimationController({
   double? value,
   this.duration,
   this.reverseDuration,
   this.debugLabel,
   this.lowerBound = 0.0,
   this.upperBound = 1.0,
   this.animationBehavior = AnimationBehavior.normal,
   required TickerProvider vsync,
 })   : assert(lowerBound != null),
       assert(upperBound != null),
       assert(upperBound >= lowerBound),
       assert(vsync != null),
       _direction = _AnimationDirection.forward {
   _ticker = vsync.createTicker(_tick);
   _internalSetValue(value ?? lowerBound);
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions