Click here to Skip to main content
15,889,804 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a getter/setter, that is being set in the top of the screen, when thr index is set, but when I try to get the value, it returns null.
Please elt me know what can I do to fix this.
Thanks.

What I have tried:

<pre>    getItemAndNavigate(index1, BuildContext context) {
      Navigator.push(context,
          MaterialPageRoute(builder: (context) => DetailScreen(index1, context)));
    }
     
    //second
     
    class DetailScreen extends StatelessWidget {
      int index1;
      BuildContext context;
      DetailScreen(this.index1, this.context);
     
      @override
      Widget build(BuildContext context) {
        // Use the Todo to create the UI.
        strings().setdepart = index1;

    print('depart: ' +
        strings().getdepart.toString());

    int get getdepart => _depart;
     
    set setdepart(int value) {
      _depart = value;
    }
Posted
Updated 22-May-20 6:07am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900