title: Flutter - [barcode_scan] ScanResult is not a subtype of type String
body: <p>I tried to scan a QR code with <code>barcode_scan</code> using Flutter with the code below, but I am getting errors all the time: <code>unknown error type 'ScanResult' is not a subtype of type 'String' in typecast Scan</code>.</p>
  <p>Could someone give me an explanation or could someone has an idea about it?</p>
  <pre><code> import 'package:barcode_scan/gen/protos/protos.pbserver.dart';
      import 'dart:async';
      import 'package:flutter/material.dart';
      import 'package:barcode_scan/barcode_scan.dart';
      import 'package:flutter/services.dart';
      import 'package:qr_flutter/qr_flutter.dart';
  
  
      class Scanner extends StatefulWidget {
      @override
      _ScannerState createState() =&gt; _ScannerState();
      }  
  
      class _ScannerState extends State&lt;Scanner&gt; {
      String result = &quot;press the camera to start the scan !&quot;;
  
      Future _scanQR() async {
      try {
        String qrResult = await BarcodeScanner.scan() as String;
        setState(() {
          result = qrResult;
        });
      } on PlatformException catch (ex) {
        if (ex.code == BarcodeScanner.cameraAccessDenied) {
          setState(() {
            result = &quot;Camera was denied&quot;;
          });
        } else {
          setState(() {
            result = &quot;Unknown Error $ex&quot;;
          });
        }
      } on FormatException {
        setState(() {
          result = &quot;You pressed the back button before scanning anything&quot;;
        });
      } catch (ex) {
        setState(() {
          result = &quot;Unknown Error $ex&quot;;
        });
      }
      }
  
      @override
      Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(&quot;QR Scanner&quot;),
        ),
        body: Center(
          child: Text(
            result,
            style: new TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold),
          ),
        ),
        floatingActionButton: FloatingActionButton.extended(
          icon: Icon(Icons.camera_alt),
          label: Text(&quot;Scan&quot;),
          onPressed: _scanQR,
        ),
      );
      }
    }
  </code></pre>