title: Unable to link to next page using Firebase key
body: <p>I'm trying to link to the next page using the firebase key.</p>
  <p>Once I scan the QR code, containing the firebase key, it should lead to the next page, which is detailpage.dart</p>
  <p>The Scanning of the QR code works as I tried displaying the value inside with a toast.
  The value that I am able to retrieve is, -Mx4_yXjX50ghfuHxqK2</p>
  <p>Ideally, once I scan the QR code, I will be shown the items in Location 1.</p>
  <p><a href="https://i.stack.imgur.com/hOhXQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hOhXQ.png" alt="enter image description here" /></a></p>
  <p>The error when i scan :</p>
  <p><a href="https://i.stack.imgur.com/4hLBT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4hLBT.jpg" alt="enter image description here" /></a></p>
  <p>How i called the Firebase:</p>
  <pre><code>final database = FirebaseDatabase(
    databaseURL:
    &quot;https://trackkit-a5cf3-default-rtdb.asia-southeast1.firebasedatabase.app&quot;)
    .reference()
    .child(&quot;NTU&quot;);
  </code></pre>
  <p>My scanning code :</p>
  <pre><code>      Future&lt;void&gt; scanQR() async {
      String barcodeScanRes;
      // Platform messages may fail, so we use a try/catch PlatformException.
      try {
        barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
            '#ff6666', 'Cancel', true, ScanMode.QR);
        print(barcodeScanRes);
      } on PlatformException {
        barcodeScanRes = 'Failed to get platform version.';
      }
  
      // If the widget was removed from the tree while the asynchronous platform
      // message was in flight, we want to discard the reply rather than calling
      // setState to update our non-existent appearance.
      if (!mounted) return;
  
      setState(() {
        _scanBarcode = barcodeScanRes;
      });
      barcode = _scanBarcode;
      Navigator.push(
        context,
        MaterialPageRoute(
            builder: (context) =&gt; detailsPage(
              referenceName: barcode,
  
  
            )),
      );
    }
  </code></pre>
  <p>My detailpage.dart (Next page)</p>
  <pre><code>
  
  
      
      class detailsPage extends StatefulWidget {
    detailsPage(
        {Key? key,
          this.heroTag,
          this.labPlace,
          this.foodName,
          this.barcode,
          this.onValueChanged,
          required this.referenceName})
        : super(key: key);
  
    final heroTag;
    final labPlace;
    final foodName;
    final barcode;
    final onValueChanged;
    String referenceName;
  
  
  
    @override
    _detailsPageState createState() =&gt; _detailsPageState();
  }
  </code></pre>
  <p>I am able to display the items if I don't go through the scanning method, but the scanning method bring an unknown error, that I am unable to solve for days! Any help is greatly appreciated!</p>