Search code examples
flutteranimationcontroller

The argument type '_ProfileImageState' can't be assigned to the parameter type 'TickerProvider'


The main objective is to allow the user to choose an image from the gallery/camera but in order to make things look good some animation has been used and entire image picking dialogue box has been designed

class _ProfileImageState extends State<ProfileImage>{

      @override

      File _image;

      //ImagePickerHandler imagePicker;

      @override
      void initState() {

        super.initState();
//initiating to start so that transition from one state to another is smooth
 
        var _controller = new AnimationController(
          vsync: this,
          duration: const Duration(milliseconds: 500),
        );


        imagePicker=new ImagePickerHandler(this.userImage(_image));


      }

Solution

  • Extending SingleTickerProviderStateMixin fixed the issue:

    class _ProfileImageState extends State with SingleTickerProviderStateMixin{