1

I am trying to have a Hook inside a Stateful Widget and this is what I tried:

class MonthScreen extends Hook<void> {
  final Month month;

  MonthScreen(this.month, {Key key}) : super(key: key); // -> 'named parameter 'key' is not defined'

  @override
  _MonthScreenState createState() => _MonthScreenState(month);
}

class _MonthScreenState extends HookState<void, MonthScreen> {
  final Month month;

  _MonthScreenState(this.month);

  @override
  void initHook() {
    super.initHook();
    //initialize things here
  }
//...

What am I doing wrong here? Flutter suggesting changing key to keys but what do I provide it with then?

Chris
  • 1,828
  • 6
  • 40
  • 108
  • 1
    What you need is a `StatefulHookWidget`. Does this answer your question? [flutter class double extends](https://stackoverflow.com/questions/66459297/flutter-class-double-extends) – Thierry Mar 04 '21 at 10:53
  • yes it does, thanks! – Chris Mar 04 '21 at 10:58

0 Answers0