title: error: Undefined name 'widget' in Dart when trying to build navigation
body: <p>Can someone help me? Newbie with Flutter here.</p>
  <p>I have this:</p>
  <pre><code>class SecondRoute extends StatelessWidget {
    final Place? place;
    const SecondRoute({Key? key, this.place}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(&quot;Second Route&quot;),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              Navigator.pop(context);
            },
            child: Text(widget.place!.text!),
          ),
        ),
      );
    }
  </code></pre>
  <p>And:</p>
  <pre><code>class PlaceDetail extends StatefulWidget {
    final Place? place;
  
    PlaceDetail({Key? key, this.place}) : super(key: key);
  
    @override
    _PlaceDetailState createState() {
      return _PlaceDetailState();
    }
  }
  </code></pre>
  <p>I successfully can navigate to the next page, but the problem is with this part:</p>
  <pre><code>child: Text(widget.place!.text!)
  </code></pre>
  <p><strong>I am trying to show some content that I fetch with JSON. In a different widget, that specific widget.place!.text! works like a charm, but in this class and widget, I can't get it to work and t thus I get the error:</strong></p>
  <pre><code>error: Undefined name 'widget'
  </code></pre>
  <p>If I extend it to State , I get the error:</p>
  <pre><code>error: The return type 'SecondRoute' isn't a 'Widget'
  </code></pre>
  <p>I tried to follow the documentation here:
  <a href="https://flutter.dev/docs/cookbook/navigation/navigation-basics" rel="nofollow noreferrer">https://flutter.dev/docs/cookbook/navigation/navigation-basics</a></p>
  <p>As I mentioned, the navigation itself works, but trying to fetch data from JSON that I had in a widget gives me the error.</p>
  <p><strong>Edit:</strong></p>
  <pre><code>Text(${place?.text!}&quot;) 
  </code></pre>
  <p>The above gives me NULL. Any chance I can get this variable sent to the new page/screen without giving me NULL value?</p>