1

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?

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
RitchyCZ
  • 11
  • 5

1 Answers1

5

In your PlayModeState class, simply use

widget.data
CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440