0

I cannot pass the controller or the offsetAnimation instances to Initialize SideBar()

SideBarWidget class

class SideBarWidget extends StatelessWidget {
  SideBarWidget({Key? key, required this.controller}) : super(key: key);

  final AnimationController controller;
  final Animation<Offset> offsetAnimation = Tween<Offset>(...).animate(...);

  final sideBar = SideBar(
    itemList: [...],
    controller: controller , //_The instance member 'controller' can't be accessed in an initializer_
    offsetAnimation: offsetAnimation ,//_The instance member 'offsetAnimation' can't be accessed in an initializer_
  );

  void toggle() {...}

  @override
  Widget build(BuildContext context) {...}
}


I also cannot use the this. method. How can I solve this...

Thank You

0 Answers0