Home > Software engineering >  AnimationController with GetView and GetxController
AnimationController with GetView and GetxController

Time:03-21

Im trying to create a animationController with a view that extends GetView. I should implement SingleGetTickerProviderMixin in my Getxcontroller but its deprecated and should use GetSingleTickerProviderStateMixin. The thing is that its require to implements the following missing method:

@override
  Ticker createTicker(TickerCallback onTick) {
    // TODO: implement createTicker
    throw UnimplementedError();
  }

I dont know how to use that and dont find any solution for that. Full GetxController:

class MainPageController extends GetxController implements GetSingleTickerProviderStateMixin {

  late AnimationController animationController;

  @override
  void onInit() {
    animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 400));
    super.onInit();
  }

  @override
  Ticker createTicker(TickerCallback onTick) {
    // TODO: implement createTicker
    throw UnimplementedError();
  }

  @override
  void didChangeDependencies(BuildContext context) {
  }
  
}

My getx version:

get: ^4.6.1

CodePudding user response:

I found a solution, was a simple mistake, only need to change:

implements GetSingleTickerProviderStateMixin {

for:

with GetSingleTickerProviderStateMixin {
  • Related