title: Unable to access variables true content. Value always stays null
body: <p>I have a problem with providing variables. I have those two variables contentname and contentbirthday which are in a onchanged as you can see below:</p>
  
  <pre><code>import 'package:biminda_app/Components/card_data.dart';
  import 'package:flutter/material.dart';
  import 'package:flutter/rendering.dart';
  import 'constants.dart';
  import 'package:provider/provider.dart';
  import 'package:biminda_app/Components/card_data.dart';
  
  class CardBasic extends StatefulWidget {
    @override
    _CardBasicState createState() =&gt; _CardBasicState();
  }
  
  class _CardBasicState extends State&lt;CardBasic&gt; {
    @override
    Widget build(BuildContext context) {
      return SizedBox(
        height: MediaQuery.of(context).size.height *
            0.58, //&lt;-- set height of the card
        child: FirstCardCreation(
          //&lt;-- new widget
          name: 'Name',
          birthday: ' Birthday',
        ),
      );
    }
  }
  
  class FirstCardCreation extends StatelessWidget {
    final String name;
    final String birthday;
  
    const FirstCardCreation({
      Key key,
      @required this.name,
      @required this.birthday,
    }) : super(key: key);
    @override
    Widget build(BuildContext context) {
      return Card(
        color: Color(0xFFef9a9a),
        margin: EdgeInsets.all(8),
        elevation: 8,
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(32)),
        child: Column(
          children: &lt;Widget&gt;[
            SizedBox(height: 8),
            Expanded(
              child:
                  FirstCardContent(contentname: name, contentbirthday: birthday),
            )
          ],
        ),
      );
    }
  }
  
  class FirstCardContent extends StatelessWidget {
    String contentname;
    String contentbirthday;
  
    FirstCardContent(
        {Key key, @required this.contentname, @required this.contentbirthday})
        : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      return Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: &lt;Widget&gt;[
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: TextField(
                style: TextStyle(
                  color: Colors.black,
                ),
                decoration: kNameInput,
                onChanged: (value1) {
                  print(contentname);
                  contentname = value1;
                },
              ),
            ),
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: TextField(
                style: TextStyle(
                  color: Colors.black,
                ),
                decoration: kBirthdayInput,
                onChanged: (value2) {
                  contentbirthday = value2;
                },
              ),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  
  <p>I have created a Provider in my main.dart, so that I can pass the information of those two variables to another class. In the class where I want to use them, I created a Consumer. On the Finish Button right at the bottom, I want to use the two variables, but the value is null. Does anyone know how I can access the variables information correctly? </p>
  
  <pre><code>import 'package:biminda_app/Components/real_new_algorithm_card.dart';
  import 'package:biminda_app/Screens/home_screen.dart';
  import 'package:flutter/material.dart';
  import '../Components/custom_Buttons.dart';
  import 'new_card_screen1.dart';
  import '../Components/constants.dart';
  import '../Components/real_new_algorithm_card.dart';
  import 'package:provider/provider.dart';
  import 'package:biminda_app/Components/card_data.dart';
  import 'package:biminda_app/Components/real_new_card.dart';
  
  class AlgorithmInput extends StatefulWidget {
    static const String id = 'new_algorithm_screen';
    @override
    _AlgorithmInputState createState() =&gt; _AlgorithmInputState();
  }
  
  class _AlgorithmInputState extends State&lt;AlgorithmInput&gt; {
    @override
    Widget build(BuildContext context) {
      return Consumer&lt;FirstCardContent&gt;(
          builder: (context, firstCardContent, child) {
        return Scaffold(
          body: SafeArea(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: &lt;Widget&gt;[
                Padding(
                  padding: const EdgeInsets.all(32.0),
                  child: Text('Feed the algorithm.', style: kBackgroundTextStyle),
                ),
                CardBasicAlgorithm(),
                Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.end,
                    children: &lt;Widget&gt;[
                      SideButton(
                          functionality: 'Back',
                          onPressed: () {
                            Navigator.pushNamed(context, NewCard.id);
                          }),
                      SideButton(
                          // TODO: Beim drücken auf den Button muss der vorherige und
                          // TODO: neue Input mitgenommen werden und in die neue Card
                          // TODO: eingetragen werden
                          functionality: 'Finish',
                          onPressed: () {
                            Navigator.pushNamed(context, HomeScreen.id);
                            Provider.of&lt;CardData&gt;(context).addCard(
                                firstCardContent.contentname,
                                firstCardContent.contentbirthday);
                            //print(firstCardContent.contentname);
                            //print(firstCardContent.contentbirthday);
                          }),
                    ],
                  ),
                ),
              ],
            ),
          ),
        );
      });
    }
  }
  </code></pre>
  
  <p>For explanation: The App wants the user to enter data (contentname and contentbirthday), which gets passed to a Listview.builder after pressing the finish button. I have created two print statements inside the onPressed to see if the values are correct. Unfortunately I only get the values null.</p>
  
  <p>Please ignore the german written TODO'S.</p>
  
  <p>Thank you for your help and time.</p>