0

I have this Stateful class and I wanna took "Data" from Stateful class to State class

Here is my code:

class PlayMode extends StatefulWidget {
  final Data data;
  PlayMode({this.data}); // Pass this to State class

  @override
  State<StatefulWidget> createState() {
    return new PlayModeState();
  }
}

How it can be done? Thanks!

RitchyCZ
  • 1
  • 4

1 Answers1

3

In your PlayModeState class, simply use

widget.data
CopsOnRoad
  • 175,842
  • 51
  • 533
  • 380