'Passing Arguments to super from the widget in flutter

Im trying to pass arguments from my widget's state into a super class, but i cannot access the "widget." from the initialization list. if i do pass it from the variables and accept an additional parameter in the state's ctor, i get the lint error: no_logic_in_create_state

Here's my code:

class TransferPage extends View {
  final String screenId;
  TransferPage(this.screenId, {Key? key}) : super(key: key);

  @override
  // ignore: no_logic_in_create_state
  State<TransferPage> createState() => TransferPageState(screenId);
}

class TransferPageState extends ViewState<TransferPage, TransferController> {
  final String screenId;

  TransferPageState(this.screenId)
      : super(TransferController(GetTransferDataUsecaseParams(screenId)));

I want to pass the id into the "super" ctor, What's the best way to go about it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source