1 year ago
#342432
Raz Gino
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?
flutter
dart
super
lint
0 Answers
Your Answer