title: The instance member 'barberData' can't be accessed in an initializer
body: <p>I wrote a code that send a map between two widgets and i get this error when I send the map from the first code to the other. Someone know what is my problem and how can I solve it?.</p>
  <p>this is the relevant part of the first code:</p>
  <pre><code>class HomeB extends StatefulWidget {
    const HomeB({Key? key}) : super(key: key);
  
    @override
    _HomeBState createState() =&gt; _HomeBState();
  }
  
  class _HomeBState extends State&lt;HomeB&gt; {
  
    Map&lt;String, dynamic&gt; barberData = {};
  
    @override
    void initState() {
      _getDataAndPrint();
      super.initState();
    }
  
    Future&lt;void&gt; _getDataAndPrint() async {
      barberData = await getBarberData();
    }
  
    final tabs = [
      widget1(),
      widget2(),
      widget3,
      ProfileB(barberData: barberData,) // here I get this error
    ];
  </code></pre>
  <p>and this is the code that suppose to get the map:</p>
  <pre><code>class ProfileB extends StatefulWidget {
    Map&lt;String, dynamic&gt; barberData;
    ProfileB({Key? key, required this.barberData}) : super(key: key);
    @override
    _ProfileBState createState() =&gt; _ProfileBState();
  }
  
  class _ProfileBState extends State&lt;ProfileB&gt; {
  
    @override
    Widget build(BuildContext context) {
      Size size = MediaQuery.of(context).size;
  
      return Scaffold(
        body: SafeArea(
          child: SingleChildScrollView(
            child: ConstrainedBox(
              constraints: BoxConstraints(
                minHeight: size.height - 90,
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Padding(
                    padding: EdgeInsets.only(
                      top: size.height * .005,
                    ),
                    child: Center(
                      child: Text(
                        widget.barberData[&quot;field1&quot;],
                        style: TextStyle(
                          fontSize: size.width * .037,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ),
                  )
                ],
              ),
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>The erros I get:</p>
  <p>&quot;Error: Can't access 'this' in a field initializer to read 'barberData'.
  ProfileB(barberData: barberData,)&quot;</p>
  <p>&quot;The instance member 'barberData' can't be accessed in an initializer.
  Try replacing the reference to the instance member with a different expression&quot;</p>